environment_config.go 796 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package client
  2. import (
  3. "context"
  4. "fmt"
  5. "github.com/porter-dev/porter/api/types"
  6. )
  7. func (c *Client) GetEnvironmentConfig(
  8. ctx context.Context,
  9. projID, clusterID, envConfID uint,
  10. ) (*types.EnvironmentConfig, error) {
  11. resp := &types.EnvironmentConfig{}
  12. err := c.getRequest(
  13. fmt.Sprintf(
  14. "/projects/%d/clusters/%d/env_config/%d",
  15. projID,
  16. clusterID,
  17. envConfID,
  18. ),
  19. nil,
  20. resp,
  21. )
  22. return resp, err
  23. }
  24. func (c *Client) GetPorterAppByEnvironment(
  25. ctx context.Context,
  26. projID, clusterID, envConfID uint,
  27. stackName string,
  28. ) (*types.PorterApp, error) {
  29. resp := &types.PorterApp{}
  30. err := c.getRequest(
  31. fmt.Sprintf(
  32. "/projects/%d/clusters/%d/env_config/%d/stacks/%s",
  33. projID,
  34. clusterID,
  35. envConfID,
  36. stackName,
  37. ),
  38. nil,
  39. resp,
  40. )
  41. return resp, err
  42. }