Add ListResolvableAliases SDK changes (#4653)

* Add API changs for list resolvable aliases
This commit is contained in:
Todd authored and GitHub committed 2024-04-17 11:13:08 -07:00
1 parent c3fc80becf
commit 608b6bb2b7
32 files changed
+614 -411

No files matched your search

+2 -2
View File
@@ -286,7 +286,7 @@ func (c *Client) AttachStoragePolicy(ctx context.Context, scopeId string, versio
if apiErr != nil {
return nil, apiErr
}
s.response = resp
s.Response = resp
return s, nil
}
@@ -350,6 +350,6 @@ func (c *Client) DetachStoragePolicy(ctx context.Context, scopeId string, versio
if apiErr != nil {
return nil, apiErr
}
s.response = resp
s.Response = resp
return s, nil
}
+15 -17
View File
@@ -30,13 +30,11 @@ type Scope struct {
AuthorizedActions []string `json:"authorized_actions,omitempty"`
AuthorizedCollectionActions map[string][]string `json:"authorized_collection_actions,omitempty"`
StoragePolicyId string `json:"storage_policy_id,omitempty"`
response *api.Response
}
type ScopeReadResult struct {
Item *Scope
response *api.Response
Response *api.Response
}
func (n ScopeReadResult) GetItem() *Scope {
@@ -44,14 +42,14 @@ func (n ScopeReadResult) GetItem() *Scope {
}
func (n ScopeReadResult) GetResponse() *api.Response {
return n.response
return n.Response
}
type ScopeCreateResult = ScopeReadResult
type ScopeUpdateResult = ScopeReadResult
type ScopeDeleteResult struct {
response *api.Response
Response *api.Response
}
// GetItem will always be nil for ScopeDeleteResult
@@ -60,7 +58,7 @@ func (n ScopeDeleteResult) GetItem() interface{} {
}
func (n ScopeDeleteResult) GetResponse() *api.Response {
return n.response
return n.Response
}
type ScopeListResult struct {
@@ -69,7 +67,7 @@ type ScopeListResult 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 ScopeListResult) GetItems() []*Scope {
@@ -93,7 +91,7 @@ func (n ScopeListResult) GetResponseType() string {
}
func (n ScopeListResult) GetResponse() *api.Response {
return n.response
return n.Response
}
// Client is a client for this collection
@@ -154,7 +152,7 @@ func (c *Client) Create(ctx context.Context, scopeId string, opt ...Option) (*Sc
if apiErr != nil {
return nil, apiErr
}
target.response = resp
target.Response = resp
return target, nil
}
@@ -195,7 +193,7 @@ func (c *Client) Read(ctx context.Context, id string, opt ...Option) (*ScopeRead
if apiErr != nil {
return nil, apiErr
}
target.response = resp
target.Response = resp
return target, nil
}
@@ -258,7 +256,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
}
@@ -299,7 +297,7 @@ func (c *Client) Delete(ctx context.Context, id string, opt ...Option) (*ScopeDe
}
target := &ScopeDeleteResult{
response: resp,
Response: resp,
}
return target, nil
}
@@ -341,7 +339,7 @@ func (c *Client) List(ctx context.Context, scopeId string, opt ...Option) (*Scop
if apiErr != nil {
return nil, apiErr
}
target.response = resp
target.Response = resp
if target.ResponseType == "complete" || target.ResponseType == "" {
return target, nil
}
@@ -399,7 +397,7 @@ func (c *Client) List(ctx context.Context, scopeId string, opt ...Option) (*Scop
target.EstItemCount = page.EstItemCount
target.ListToken = page.ListToken
target.ResponseType = page.ResponseType
target.response = resp
target.Response = resp
if target.ResponseType == "complete" {
break
}
@@ -434,11 +432,11 @@ func (c *Client) List(ctx context.Context, scopeId string, opt ...Option) (*Scop
// 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,