v1_stack.go 836 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package client
  2. import (
  3. "context"
  4. "fmt"
  5. "github.com/porter-dev/porter/api/types"
  6. )
  7. // ListStacks retrieves the list of stacks
  8. func (c *Client) ListStacks(
  9. ctx context.Context,
  10. projectID, clusterID uint,
  11. namespace string,
  12. ) (*types.StackListResponse, error) {
  13. resp := &types.StackListResponse{}
  14. err := c.getRequest(
  15. fmt.Sprintf(
  16. "/v1/projects/%d/clusters/%d/namespaces/%s/stacks",
  17. projectID, clusterID, namespace,
  18. ),
  19. nil,
  20. resp,
  21. )
  22. return resp, err
  23. }
  24. func (c *Client) AddEnvGroupToStack(
  25. ctx context.Context,
  26. projectID, clusterID uint,
  27. namespace, stackID string,
  28. req *types.CreateStackEnvGroupRequest,
  29. ) error {
  30. err := c.patchRequest(
  31. fmt.Sprintf(
  32. "/v1/projects/%d/clusters/%d/namespaces/%s/stacks/%s/add_env_group",
  33. projectID, clusterID, namespace, stackID,
  34. ),
  35. req,
  36. nil,
  37. )
  38. return err
  39. }