environment.go 855 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package client
  2. import (
  3. "context"
  4. "fmt"
  5. "github.com/porter-dev/porter/api/types"
  6. )
  7. func (c *Client) CreateDeployment(
  8. ctx context.Context,
  9. projID, gitInstallationID, clusterID uint,
  10. req *types.CreateDeploymentRequest,
  11. ) (*types.Deployment, error) {
  12. resp := &types.Deployment{}
  13. err := c.postRequest(
  14. fmt.Sprintf(
  15. "/projects/%d/gitrepos/%d/clusters/%d/deployment",
  16. projID, gitInstallationID, clusterID,
  17. ),
  18. req,
  19. resp,
  20. )
  21. return resp, err
  22. }
  23. func (c *Client) FinalizeDeployment(
  24. ctx context.Context,
  25. projID, gitInstallationID, clusterID uint,
  26. req *types.FinalizeDeploymentRequest,
  27. ) (*types.Deployment, error) {
  28. resp := &types.Deployment{}
  29. err := c.postRequest(
  30. fmt.Sprintf(
  31. "/projects/%d/gitrepos/%d/clusters/%d/deployment/finalize",
  32. projID, gitInstallationID, clusterID,
  33. ),
  34. req,
  35. resp,
  36. )
  37. return resp, err
  38. }