Add ListResolvableAliases SDK changes (#4653)
* Add API changs for list resolvable aliases
This commit is contained in:
32 files changed
+614
-411
No files matched your search
@@ -34,13 +34,11 @@ type HostSet struct {
|
||||
SyncIntervalSeconds int32 `json:"sync_interval_seconds,omitempty"`
|
||||
Attributes map[string]interface{} `json:"attributes,omitempty"`
|
||||
AuthorizedActions []string `json:"authorized_actions,omitempty"`
|
||||
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
type HostSetReadResult struct {
|
||||
Item *HostSet
|
||||
response *api.Response
|
||||
Response *api.Response
|
||||
}
|
||||
|
||||
func (n HostSetReadResult) GetItem() *HostSet {
|
||||
@@ -48,14 +46,14 @@ func (n HostSetReadResult) GetItem() *HostSet {
|
||||
}
|
||||
|
||||
func (n HostSetReadResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
return n.Response
|
||||
}
|
||||
|
||||
type HostSetCreateResult = HostSetReadResult
|
||||
type HostSetUpdateResult = HostSetReadResult
|
||||
|
||||
type HostSetDeleteResult struct {
|
||||
response *api.Response
|
||||
Response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for HostSetDeleteResult
|
||||
@@ -64,7 +62,7 @@ func (n HostSetDeleteResult) GetItem() interface{} {
|
||||
}
|
||||
|
||||
func (n HostSetDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
return n.Response
|
||||
}
|
||||
|
||||
type HostSetListResult struct {
|
||||
@@ -73,7 +71,7 @@ type HostSetListResult struct {
|
||||
RemovedIds []string `json:"removed_ids,omitempty"`
|
||||
ListToken string `json:"list_token,omitempty"`
|
||||
ResponseType string `json:"response_type,omitempty"`
|
||||
response *api.Response
|
||||
Response *api.Response
|
||||
}
|
||||
|
||||
func (n HostSetListResult) GetItems() []*HostSet {
|
||||
@@ -97,7 +95,7 @@ func (n HostSetListResult) GetResponseType() string {
|
||||
}
|
||||
|
||||
func (n HostSetListResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
return n.Response
|
||||
}
|
||||
|
||||
// Client is a client for this collection
|
||||
@@ -158,7 +156,7 @@ func (c *Client) Create(ctx context.Context, hostCatalogId string, opt ...Option
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
return target, nil
|
||||
}
|
||||
|
||||
@@ -199,7 +197,7 @@ func (c *Client) Read(ctx context.Context, id string, opt ...Option) (*HostSetRe
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
return target, nil
|
||||
}
|
||||
|
||||
@@ -262,7 +260,7 @@ func (c *Client) Update(ctx context.Context, id string, version uint32, opt ...O
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
return target, nil
|
||||
}
|
||||
|
||||
@@ -303,7 +301,7 @@ func (c *Client) Delete(ctx context.Context, id string, opt ...Option) (*HostSet
|
||||
}
|
||||
|
||||
target := &HostSetDeleteResult{
|
||||
response: resp,
|
||||
Response: resp,
|
||||
}
|
||||
return target, nil
|
||||
}
|
||||
@@ -345,7 +343,7 @@ func (c *Client) List(ctx context.Context, hostCatalogId string, opt ...Option)
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
if target.ResponseType == "complete" || target.ResponseType == "" {
|
||||
return target, nil
|
||||
}
|
||||
@@ -403,7 +401,7 @@ func (c *Client) List(ctx context.Context, hostCatalogId string, opt ...Option)
|
||||
target.EstItemCount = page.EstItemCount
|
||||
target.ListToken = page.ListToken
|
||||
target.ResponseType = page.ResponseType
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
if target.ResponseType == "complete" {
|
||||
break
|
||||
}
|
||||
@@ -438,11 +436,11 @@ func (c *Client) List(ctx context.Context, hostCatalogId string, opt ...Option)
|
||||
// Finally, since we made at least 2 requests to the server to fulfill this
|
||||
// function call, resp.Body and resp.Map will only contain the most recent response.
|
||||
// Overwrite them with the true response.
|
||||
target.response.Body.Reset()
|
||||
if err := json.NewEncoder(target.response.Body).Encode(target); err != nil {
|
||||
target.Response.Body.Reset()
|
||||
if err := json.NewEncoder(target.Response.Body).Encode(target); err != nil {
|
||||
return nil, fmt.Errorf("error encoding final JSON list response: %w", err)
|
||||
}
|
||||
if err := json.Unmarshal(target.response.Body.Bytes(), &target.response.Map); err != nil {
|
||||
if err := json.Unmarshal(target.Response.Body.Bytes(), &target.Response.Map); err != nil {
|
||||
return nil, fmt.Errorf("error encoding final map list response: %w", err)
|
||||
}
|
||||
// Note: the HTTP response body is consumed by resp.Decode in the loop,
|
||||
@@ -516,7 +514,7 @@ func (c *Client) AddHosts(ctx context.Context, id string, version uint32, hostId
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
return target, nil
|
||||
}
|
||||
|
||||
@@ -582,7 +580,7 @@ func (c *Client) SetHosts(ctx context.Context, id string, version uint32, hostId
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
return target, nil
|
||||
}
|
||||
|
||||
@@ -652,6 +650,6 @@ func (c *Client) RemoveHosts(ctx context.Context, id string, version uint32, hos
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
return target, nil
|
||||
}
|
||||
Reference in new issue
Block a user