Version can be passed through request body (#281)
* Scopes inline version into update request body. * Users inline version into update request body. * Group inline version into update and add|set|remove member request body. * Role inline version into update and add|set|remove grant|principal request body. * Auth method inline version into update request body. * Auth Account inline version into update request body. * host catalog version is inlined for update. * Gen after merge. * Submitting template changes for version handling.
This commit is contained in:
1 parent
e20c150617
commit
d86e58476f
62 files changed
+1629
-2137
No files matched your search
+8
-17
@@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/kr/pretty"
|
||||
@@ -116,15 +115,13 @@ func (c *GroupsClient) Update(ctx context.Context, groupId string, version uint3
|
||||
version = existingTarget.Version
|
||||
}
|
||||
|
||||
opts.valueMap["version"] = version
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "PATCH", fmt.Sprintf("groups/%s", groupId), opts.valueMap, apiOpts...)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error creating Update request: %w", err)
|
||||
}
|
||||
|
||||
q := url.Values{}
|
||||
q.Add("version", fmt.Sprintf("%d", version))
|
||||
req.URL.RawQuery = q.Encode()
|
||||
|
||||
resp, err := c.client.Do(req)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error performing client request during Update call: %w", err)
|
||||
@@ -228,6 +225,8 @@ func (c *GroupsClient) AddMembers(ctx context.Context, groupId string, version u
|
||||
version = existingTarget.Version
|
||||
}
|
||||
|
||||
opts.valueMap["version"] = version
|
||||
|
||||
if len(memberIds) > 0 {
|
||||
opts.valueMap["member_ids"] = memberIds
|
||||
}
|
||||
@@ -237,10 +236,6 @@ func (c *GroupsClient) AddMembers(ctx context.Context, groupId string, version u
|
||||
return nil, nil, fmt.Errorf("error creating AddMembers request: %w", err)
|
||||
}
|
||||
|
||||
q := url.Values{}
|
||||
q.Add("version", fmt.Sprintf("%d", version))
|
||||
req.URL.RawQuery = q.Encode()
|
||||
|
||||
resp, err := c.client.Do(req)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error performing client request during AddMembers call: %w", err)
|
||||
@@ -282,6 +277,8 @@ func (c *GroupsClient) SetMembers(ctx context.Context, groupId string, version u
|
||||
version = existingTarget.Version
|
||||
}
|
||||
|
||||
opts.valueMap["version"] = version
|
||||
|
||||
if len(memberIds) > 0 {
|
||||
opts.valueMap["member_ids"] = memberIds
|
||||
} else if memberIds != nil {
|
||||
@@ -294,10 +291,6 @@ func (c *GroupsClient) SetMembers(ctx context.Context, groupId string, version u
|
||||
return nil, nil, fmt.Errorf("error creating SetMembers request: %w", err)
|
||||
}
|
||||
|
||||
q := url.Values{}
|
||||
q.Add("version", fmt.Sprintf("%d", version))
|
||||
req.URL.RawQuery = q.Encode()
|
||||
|
||||
resp, err := c.client.Do(req)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error performing client request during SetMembers call: %w", err)
|
||||
@@ -339,6 +332,8 @@ func (c *GroupsClient) RemoveMembers(ctx context.Context, groupId string, versio
|
||||
version = existingTarget.Version
|
||||
}
|
||||
|
||||
opts.valueMap["version"] = version
|
||||
|
||||
if len(memberIds) > 0 {
|
||||
opts.valueMap["member_ids"] = memberIds
|
||||
}
|
||||
@@ -348,10 +343,6 @@ func (c *GroupsClient) RemoveMembers(ctx context.Context, groupId string, versio
|
||||
return nil, nil, fmt.Errorf("error creating RemoveMembers request: %w", err)
|
||||
}
|
||||
|
||||
q := url.Values{}
|
||||
q.Add("version", fmt.Sprintf("%d", version))
|
||||
req.URL.RawQuery = q.Encode()
|
||||
|
||||
resp, err := c.client.Do(req)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error performing client request during RemoveMembers call: %w", err)
|
||||
|
||||
Reference in new issue
Block a user