get_state.go 489 B

12345678910111213141516171819202122232425262728
  1. package client
  2. import (
  3. "context"
  4. "fmt"
  5. ptypes "github.com/porter-dev/porter/provisioner/types"
  6. )
  7. // CreateResource posts Terraform output to the provisioner service and creates the backing
  8. // resource in the database
  9. func (c *Client) GetState(
  10. ctx context.Context,
  11. projID, infraID uint,
  12. ) (*ptypes.TFState, error) {
  13. resp := &ptypes.TFState{}
  14. err := c.getRequest(
  15. fmt.Sprintf(
  16. "/projects/%d/infras/%d/state",
  17. projID, infraID,
  18. ),
  19. nil,
  20. resp,
  21. )
  22. return resp, err
  23. }