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
@@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/kr/pretty"
|
||||
@@ -126,15 +125,13 @@ func (c *HostsClient) Update(ctx context.Context, hostCatalogId string, hostId s
|
||||
version = existingTarget.Version
|
||||
}
|
||||
|
||||
opts.valueMap["version"] = version
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "PATCH", fmt.Sprintf("host-catalogs/%s/hosts/%s", hostCatalogId, hostId), 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)
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/kr/pretty"
|
||||
@@ -121,15 +120,13 @@ func (c *HostCatalogsClient) Update(ctx context.Context, hostCatalogId string, v
|
||||
version = existingTarget.Version
|
||||
}
|
||||
|
||||
opts.valueMap["version"] = version
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "PATCH", fmt.Sprintf("host-catalogs/%s", hostCatalogId), 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)
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/kr/pretty"
|
||||
@@ -127,15 +126,13 @@ func (c *HostSetsClient) Update(ctx context.Context, hostCatalogId string, hostS
|
||||
version = existingTarget.Version
|
||||
}
|
||||
|
||||
opts.valueMap["version"] = version
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "PATCH", fmt.Sprintf("host-catalogs/%s/host-sets/%s", hostCatalogId, hostSetId), 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)
|
||||
@@ -250,6 +247,8 @@ func (c *HostSetsClient) AddHosts(ctx context.Context, hostCatalogId string, hos
|
||||
version = existingTarget.Version
|
||||
}
|
||||
|
||||
opts.valueMap["version"] = version
|
||||
|
||||
if len(hostIds) > 0 {
|
||||
opts.valueMap["host_ids"] = hostIds
|
||||
}
|
||||
@@ -259,10 +258,6 @@ func (c *HostSetsClient) AddHosts(ctx context.Context, hostCatalogId string, hos
|
||||
return nil, nil, fmt.Errorf("error creating AddHosts 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 AddHosts call: %w", err)
|
||||
@@ -307,6 +302,8 @@ func (c *HostSetsClient) SetHosts(ctx context.Context, hostCatalogId string, hos
|
||||
version = existingTarget.Version
|
||||
}
|
||||
|
||||
opts.valueMap["version"] = version
|
||||
|
||||
if len(hostIds) > 0 {
|
||||
opts.valueMap["host_ids"] = hostIds
|
||||
} else if hostIds != nil {
|
||||
@@ -319,10 +316,6 @@ func (c *HostSetsClient) SetHosts(ctx context.Context, hostCatalogId string, hos
|
||||
return nil, nil, fmt.Errorf("error creating SetHosts 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 SetHosts call: %w", err)
|
||||
@@ -367,6 +360,8 @@ func (c *HostSetsClient) RemoveHosts(ctx context.Context, hostCatalogId string,
|
||||
version = existingTarget.Version
|
||||
}
|
||||
|
||||
opts.valueMap["version"] = version
|
||||
|
||||
if len(hostIds) > 0 {
|
||||
opts.valueMap["host_ids"] = hostIds
|
||||
}
|
||||
@@ -376,10 +371,6 @@ func (c *HostSetsClient) RemoveHosts(ctx context.Context, hostCatalogId string,
|
||||
return nil, nil, fmt.Errorf("error creating RemoveHosts 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 RemoveHosts call: %w", err)
|
||||
|
||||
Reference in new issue
Block a user