2
0

stack.go 698 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package client
  2. import (
  3. "context"
  4. "fmt"
  5. "github.com/porter-dev/porter/api/types"
  6. )
  7. // CreateStack creates the stack
  8. func (c *Client) CreateStack(
  9. ctx context.Context,
  10. projectID, clusterID uint,
  11. req *types.CreateStackReleaseRequest,
  12. ) error {
  13. return c.postRequest(
  14. fmt.Sprintf(
  15. "/projects/%d/clusters/%d/stacks",
  16. projectID, clusterID,
  17. ),
  18. req,
  19. nil,
  20. )
  21. }
  22. // UpdateStack updates the stack
  23. func (c *Client) UpdateStack(
  24. ctx context.Context,
  25. projectID, clusterID uint,
  26. stackName string,
  27. req *types.CreateStackReleaseRequest,
  28. ) error {
  29. return c.patchRequest(
  30. fmt.Sprintf(
  31. "/projects/%d/clusters/%d/stacks/%s",
  32. projectID, clusterID, stackName,
  33. ),
  34. req,
  35. nil,
  36. )
  37. }