Skip to content

Commit

Permalink
SCALRCORE-20543 - API > link environment to policy group optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
soltysss committed Apr 12, 2022
1 parent 93dc92a commit d3ccafe
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions policy_group_environments.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"errors"
"fmt"
"net/url"

"github.com/svanharmelen/jsonapi"
)

// Compile-time proof of interface implementation.
Expand Down Expand Up @@ -65,13 +67,11 @@ func (s *policyGroupEnvironment) Create(ctx context.Context, options PolicyGroup
if err := options.valid(); err != nil {
return err
}

type PolicyGroupEnvironmentsPayload struct {
Data []*PolicyGroupEnvironment `json:"data"`
}

u := fmt.Sprintf("policy-groups/%s/relationships/environments", url.QueryEscape(options.PolicyGroupID))
payload := PolicyGroupEnvironmentsPayload{Data: options.PolicyGroupEnvironments}
payload, err := jsonapi.Marshal(options.PolicyGroupEnvironments)
if err != nil {
return err
}
req, err := s.client.newJsonRequest("POST", u, payload)
if err != nil {
return err
Expand Down

0 comments on commit d3ccafe

Please sign in to comment.