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

+15 -17
View File
@@ -30,13 +30,11 @@ type CredentialStore struct {
Attributes map[string]interface{} `json:"attributes,omitempty"`
AuthorizedActions []string `json:"authorized_actions,omitempty"`
AuthorizedCollectionActions map[string][]string `json:"authorized_collection_actions,omitempty"`
response *api.Response
}
type CredentialStoreReadResult struct {
Item *CredentialStore
response *api.Response
Response *api.Response
}
func (n CredentialStoreReadResult) GetItem() *CredentialStore {
@@ -44,14 +42,14 @@ func (n CredentialStoreReadResult) GetItem() *CredentialStore {
}
func (n CredentialStoreReadResult) GetResponse() *api.Response {
return n.response
return n.Response
}
type CredentialStoreCreateResult = CredentialStoreReadResult
type CredentialStoreUpdateResult = CredentialStoreReadResult
type CredentialStoreDeleteResult struct {
response *api.Response
Response *api.Response
}
// GetItem will always be nil for CredentialStoreDeleteResult
@@ -60,7 +58,7 @@ func (n CredentialStoreDeleteResult) GetItem() interface{} {
}
func (n CredentialStoreDeleteResult) GetResponse() *api.Response {
return n.response
return n.Response
}
type CredentialStoreListResult struct {
@@ -69,7 +67,7 @@ type CredentialStoreListResult 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 CredentialStoreListResult) GetItems() []*CredentialStore {
@@ -93,7 +91,7 @@ func (n CredentialStoreListResult) GetResponseType() string {
}
func (n CredentialStoreListResult) GetResponse() *api.Response {
return n.response
return n.Response
}
// Client is a client for this collection
@@ -159,7 +157,7 @@ func (c *Client) Create(ctx context.Context, resourceType string, scopeId string
if apiErr != nil {
return nil, apiErr
}
target.response = resp
target.Response = resp
return target, nil
}
@@ -200,7 +198,7 @@ func (c *Client) Read(ctx context.Context, id string, opt ...Option) (*Credentia
if apiErr != nil {
return nil, apiErr
}
target.response = resp
target.Response = resp
return target, nil
}
@@ -263,7 +261,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
}
@@ -304,7 +302,7 @@ func (c *Client) Delete(ctx context.Context, id string, opt ...Option) (*Credent
}
target := &CredentialStoreDeleteResult{
response: resp,
Response: resp,
}
return target, nil
}
@@ -346,7 +344,7 @@ func (c *Client) List(ctx context.Context, scopeId string, opt ...Option) (*Cred
if apiErr != nil {
return nil, apiErr
}
target.response = resp
target.Response = resp
if target.ResponseType == "complete" || target.ResponseType == "" {
return target, nil
}
@@ -404,7 +402,7 @@ func (c *Client) List(ctx context.Context, scopeId string, opt ...Option) (*Cred
target.EstItemCount = page.EstItemCount
target.ListToken = page.ListToken
target.ResponseType = page.ResponseType
target.response = resp
target.Response = resp
if target.ResponseType == "complete" {
break
}
@@ -439,11 +437,11 @@ func (c *Client) List(ctx context.Context, scopeId string, opt ...Option) (*Cred
// 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,