Update target credential library service, API, SDK, CLI (#1343)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-06-25 14:06:31 -04:00
1 parent 83c65d0d4b
commit 86c9a90554
27 files changed
+1474 -1127

No files matched your search

+7
View File
@@ -326,9 +326,11 @@ func (c *Client) AddHosts(ctx context.Context, id string, version uint32, hostId
if id == "" {
return nil, fmt.Errorf("empty id value passed into AddHosts request")
}
if len(hostIds) == 0 {
return nil, errors.New("empty hostIds passed into AddHosts request")
}
if c.client == nil {
return nil, errors.New("nil client")
}
@@ -356,6 +358,7 @@ func (c *Client) AddHosts(ctx context.Context, id string, version uint32, hostId
}
opts.postMap["version"] = version
opts.postMap["host_ids"] = hostIds
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("host-sets/%s:add-hosts", id), opts.postMap, apiOpts...)
@@ -421,6 +424,7 @@ func (c *Client) SetHosts(ctx context.Context, id string, version uint32, hostId
}
opts.postMap["version"] = version
opts.postMap["host_ids"] = hostIds
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("host-sets/%s:set-hosts", id), opts.postMap, apiOpts...)
@@ -458,9 +462,11 @@ func (c *Client) RemoveHosts(ctx context.Context, id string, version uint32, hos
if id == "" {
return nil, fmt.Errorf("empty id value passed into RemoveHosts request")
}
if len(hostIds) == 0 {
return nil, errors.New("empty hostIds passed into RemoveHosts request")
}
if c.client == nil {
return nil, errors.New("nil client")
}
@@ -488,6 +494,7 @@ func (c *Client) RemoveHosts(ctx context.Context, id string, version uint32, hos
}
opts.postMap["version"] = version
opts.postMap["host_ids"] = hostIds
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("host-sets/%s:remove-hosts", id), opts.postMap, apiOpts...)