create_resource.go 456 B

123456789101112131415161718192021222324252627
  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) CreateResource(
  10. ctx context.Context,
  11. workspaceID string,
  12. req *ptypes.CreateResourceRequest,
  13. ) error {
  14. err := c.postRequest(
  15. fmt.Sprintf(
  16. "/%s/resource",
  17. workspaceID,
  18. ),
  19. req,
  20. nil,
  21. )
  22. return err
  23. }