Update target credential library service, API, SDK, CLI (#1343)
This commit is contained in:
1 parent
83c65d0d4b
commit
86c9a90554
27 files changed
+1474
-1127
No files matched your search
@@ -325,9 +325,11 @@ func (c *Client) AddMembers(ctx context.Context, id string, version uint32, memb
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("empty id value passed into AddMembers request")
|
||||
}
|
||||
|
||||
if len(memberIds) == 0 {
|
||||
return nil, errors.New("empty memberIds passed into AddMembers request")
|
||||
}
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.New("nil client")
|
||||
}
|
||||
@@ -355,6 +357,7 @@ func (c *Client) AddMembers(ctx context.Context, id string, version uint32, memb
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["member_ids"] = memberIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("groups/%s:add-members", id), opts.postMap, apiOpts...)
|
||||
@@ -420,6 +423,7 @@ func (c *Client) SetMembers(ctx context.Context, id string, version uint32, memb
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["member_ids"] = memberIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("groups/%s:set-members", id), opts.postMap, apiOpts...)
|
||||
@@ -457,9 +461,11 @@ func (c *Client) RemoveMembers(ctx context.Context, id string, version uint32, m
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("empty id value passed into RemoveMembers request")
|
||||
}
|
||||
|
||||
if len(memberIds) == 0 {
|
||||
return nil, errors.New("empty memberIds passed into RemoveMembers request")
|
||||
}
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.New("nil client")
|
||||
}
|
||||
@@ -487,6 +493,7 @@ func (c *Client) RemoveMembers(ctx context.Context, id string, version uint32, m
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["member_ids"] = memberIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("groups/%s:remove-members", id), opts.postMap, apiOpts...)
|
||||
|
||||
@@ -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...)
|
||||
|
||||
@@ -328,9 +328,11 @@ func (c *Client) AddGrants(ctx context.Context, id string, version uint32, grant
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("empty id value passed into AddGrants request")
|
||||
}
|
||||
|
||||
if len(grantStrings) == 0 {
|
||||
return nil, errors.New("empty grantStrings passed into AddGrants request")
|
||||
}
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.New("nil client")
|
||||
}
|
||||
@@ -358,6 +360,7 @@ func (c *Client) AddGrants(ctx context.Context, id string, version uint32, grant
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["grant_strings"] = grantStrings
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("roles/%s:add-grants", id), opts.postMap, apiOpts...)
|
||||
@@ -395,9 +398,11 @@ func (c *Client) AddPrincipals(ctx context.Context, id string, version uint32, p
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("empty id value passed into AddPrincipals request")
|
||||
}
|
||||
|
||||
if len(principalIds) == 0 {
|
||||
return nil, errors.New("empty principalIds passed into AddPrincipals request")
|
||||
}
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.New("nil client")
|
||||
}
|
||||
@@ -425,6 +430,7 @@ func (c *Client) AddPrincipals(ctx context.Context, id string, version uint32, p
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["principal_ids"] = principalIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("roles/%s:add-principals", id), opts.postMap, apiOpts...)
|
||||
@@ -490,6 +496,7 @@ func (c *Client) SetGrants(ctx context.Context, id string, version uint32, grant
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["grant_strings"] = grantStrings
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("roles/%s:set-grants", id), opts.postMap, apiOpts...)
|
||||
@@ -555,6 +562,7 @@ func (c *Client) SetPrincipals(ctx context.Context, id string, version uint32, p
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["principal_ids"] = principalIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("roles/%s:set-principals", id), opts.postMap, apiOpts...)
|
||||
@@ -592,9 +600,11 @@ func (c *Client) RemoveGrants(ctx context.Context, id string, version uint32, gr
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("empty id value passed into RemoveGrants request")
|
||||
}
|
||||
|
||||
if len(grantStrings) == 0 {
|
||||
return nil, errors.New("empty grantStrings passed into RemoveGrants request")
|
||||
}
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.New("nil client")
|
||||
}
|
||||
@@ -622,6 +632,7 @@ func (c *Client) RemoveGrants(ctx context.Context, id string, version uint32, gr
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["grant_strings"] = grantStrings
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("roles/%s:remove-grants", id), opts.postMap, apiOpts...)
|
||||
@@ -659,9 +670,11 @@ func (c *Client) RemovePrincipals(ctx context.Context, id string, version uint32
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("empty id value passed into RemovePrincipals request")
|
||||
}
|
||||
|
||||
if len(principalIds) == 0 {
|
||||
return nil, errors.New("empty principalIds passed into RemovePrincipals request")
|
||||
}
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.New("nil client")
|
||||
}
|
||||
@@ -689,6 +702,7 @@ func (c *Client) RemovePrincipals(ctx context.Context, id string, version uint32
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["principal_ids"] = principalIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("roles/%s:remove-principals", id), opts.postMap, apiOpts...)
|
||||
|
||||
@@ -6,6 +6,5 @@ type CredentialLibrary struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
CredentialStoreId string `json:"credential_store_id,omitempty"`
|
||||
Purpose string `json:"purpose,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
@@ -87,6 +87,18 @@ func WithRecursive(recurse bool) Option {
|
||||
}
|
||||
}
|
||||
|
||||
func WithApplicationCredentialLibraryIds(inApplicationCredentialLibraryIds []string) Option {
|
||||
return func(o *options) {
|
||||
o.postMap["application_credential_library_ids"] = inApplicationCredentialLibraryIds
|
||||
}
|
||||
}
|
||||
|
||||
func DefaultApplicationCredentialLibraryIds() Option {
|
||||
return func(o *options) {
|
||||
o.postMap["application_credential_library_ids"] = nil
|
||||
}
|
||||
}
|
||||
|
||||
func WithAttributes(inAttributes map[string]interface{}) Option {
|
||||
return func(o *options) {
|
||||
o.postMap["attributes"] = inAttributes
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// Code generated by "make api"; DO NOT EDIT.
|
||||
package targets
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type SessionCredential struct {
|
||||
CredentialLibrary *CredentialLibrary `json:"credential_library,omitempty"`
|
||||
Secret string `json:"secret,omitempty"`
|
||||
Secret json.RawMessage `json:"secret,omitempty"`
|
||||
}
|
||||
+30
-30
@@ -13,24 +13,24 @@ import (
|
||||
)
|
||||
|
||||
type Target struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
ScopeId string `json:"scope_id,omitempty"`
|
||||
Scope *scopes.ScopeInfo `json:"scope,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
CreatedTime time.Time `json:"created_time,omitempty"`
|
||||
UpdatedTime time.Time `json:"updated_time,omitempty"`
|
||||
Version uint32 `json:"version,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
HostSetIds []string `json:"host_set_ids,omitempty"`
|
||||
HostSets []*HostSet `json:"host_sets,omitempty"`
|
||||
SessionMaxSeconds uint32 `json:"session_max_seconds,omitempty"`
|
||||
SessionConnectionLimit int32 `json:"session_connection_limit,omitempty"`
|
||||
WorkerFilter string `json:"worker_filter,omitempty"`
|
||||
CredentialLibraryIds []string `json:"credential_library_ids,omitempty"`
|
||||
CredentialLibraries []*CredentialLibrary `json:"credential_libraries,omitempty"`
|
||||
Attributes map[string]interface{} `json:"attributes,omitempty"`
|
||||
AuthorizedActions []string `json:"authorized_actions,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
ScopeId string `json:"scope_id,omitempty"`
|
||||
Scope *scopes.ScopeInfo `json:"scope,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
CreatedTime time.Time `json:"created_time,omitempty"`
|
||||
UpdatedTime time.Time `json:"updated_time,omitempty"`
|
||||
Version uint32 `json:"version,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
HostSetIds []string `json:"host_set_ids,omitempty"`
|
||||
HostSets []*HostSet `json:"host_sets,omitempty"`
|
||||
SessionMaxSeconds uint32 `json:"session_max_seconds,omitempty"`
|
||||
SessionConnectionLimit int32 `json:"session_connection_limit,omitempty"`
|
||||
WorkerFilter string `json:"worker_filter,omitempty"`
|
||||
ApplicationCredentialLibraryIds []string `json:"application_credential_library_ids,omitempty"`
|
||||
ApplicationCredentialLibraries []*CredentialLibrary `json:"application_credential_libraries,omitempty"`
|
||||
Attributes map[string]interface{} `json:"attributes,omitempty"`
|
||||
AuthorizedActions []string `json:"authorized_actions,omitempty"`
|
||||
|
||||
response *api.Response
|
||||
}
|
||||
@@ -333,13 +333,11 @@ func (c *Client) List(ctx context.Context, scopeId string, opt ...Option) (*Targ
|
||||
return target, nil
|
||||
}
|
||||
|
||||
func (c *Client) AddCredentialLibraries(ctx context.Context, id string, version uint32, credentialLibraryIds []string, opt ...Option) (*TargetUpdateResult, error) {
|
||||
func (c *Client) AddCredentialLibraries(ctx context.Context, id string, version uint32, opt ...Option) (*TargetUpdateResult, error) {
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("empty id value passed into AddCredentialLibraries request")
|
||||
}
|
||||
if len(credentialLibraryIds) == 0 {
|
||||
return nil, errors.New("empty credentialLibraryIds passed into AddCredentialLibraries request")
|
||||
}
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.New("nil client")
|
||||
}
|
||||
@@ -367,7 +365,6 @@ func (c *Client) AddCredentialLibraries(ctx context.Context, id string, version
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
opts.postMap["credential_library_ids"] = credentialLibraryIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("targets/%s:add-credential-libraries", id), opts.postMap, apiOpts...)
|
||||
if err != nil {
|
||||
@@ -404,9 +401,11 @@ func (c *Client) AddHostSets(ctx context.Context, id string, version uint32, hos
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("empty id value passed into AddHostSets request")
|
||||
}
|
||||
|
||||
if len(hostSetIds) == 0 {
|
||||
return nil, errors.New("empty hostSetIds passed into AddHostSets request")
|
||||
}
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.New("nil client")
|
||||
}
|
||||
@@ -434,6 +433,7 @@ func (c *Client) AddHostSets(ctx context.Context, id string, version uint32, hos
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["host_set_ids"] = hostSetIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("targets/%s:add-host-sets", id), opts.postMap, apiOpts...)
|
||||
@@ -467,7 +467,7 @@ func (c *Client) AddHostSets(ctx context.Context, id string, version uint32, hos
|
||||
return target, nil
|
||||
}
|
||||
|
||||
func (c *Client) SetCredentialLibraries(ctx context.Context, id string, version uint32, credentialLibraryIds []string, opt ...Option) (*TargetUpdateResult, error) {
|
||||
func (c *Client) SetCredentialLibraries(ctx context.Context, id string, version uint32, opt ...Option) (*TargetUpdateResult, error) {
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("empty id value passed into SetCredentialLibraries request")
|
||||
}
|
||||
@@ -499,7 +499,6 @@ func (c *Client) SetCredentialLibraries(ctx context.Context, id string, version
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
opts.postMap["credential_library_ids"] = credentialLibraryIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("targets/%s:set-credential-libraries", id), opts.postMap, apiOpts...)
|
||||
if err != nil {
|
||||
@@ -564,6 +563,7 @@ func (c *Client) SetHostSets(ctx context.Context, id string, version uint32, hos
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["host_set_ids"] = hostSetIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("targets/%s:set-host-sets", id), opts.postMap, apiOpts...)
|
||||
@@ -597,13 +597,11 @@ func (c *Client) SetHostSets(ctx context.Context, id string, version uint32, hos
|
||||
return target, nil
|
||||
}
|
||||
|
||||
func (c *Client) RemoveCredentialLibraries(ctx context.Context, id string, version uint32, credentialLibraryIds []string, opt ...Option) (*TargetUpdateResult, error) {
|
||||
func (c *Client) RemoveCredentialLibraries(ctx context.Context, id string, version uint32, opt ...Option) (*TargetUpdateResult, error) {
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("empty id value passed into RemoveCredentialLibraries request")
|
||||
}
|
||||
if len(credentialLibraryIds) == 0 {
|
||||
return nil, errors.New("empty credentialLibraryIds passed into RemoveCredentialLibraries request")
|
||||
}
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.New("nil client")
|
||||
}
|
||||
@@ -631,7 +629,6 @@ func (c *Client) RemoveCredentialLibraries(ctx context.Context, id string, versi
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
opts.postMap["credential_library_ids"] = credentialLibraryIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("targets/%s:remove-credential-libraries", id), opts.postMap, apiOpts...)
|
||||
if err != nil {
|
||||
@@ -668,9 +665,11 @@ func (c *Client) RemoveHostSets(ctx context.Context, id string, version uint32,
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("empty id value passed into RemoveHostSets request")
|
||||
}
|
||||
|
||||
if len(hostSetIds) == 0 {
|
||||
return nil, errors.New("empty hostSetIds passed into RemoveHostSets request")
|
||||
}
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.New("nil client")
|
||||
}
|
||||
@@ -698,6 +697,7 @@ func (c *Client) RemoveHostSets(ctx context.Context, id string, version uint32,
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["host_set_ids"] = hostSetIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("targets/%s:remove-host-sets", id), opts.postMap, apiOpts...)
|
||||
|
||||
@@ -329,9 +329,11 @@ func (c *Client) AddAccounts(ctx context.Context, id string, version uint32, acc
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("empty id value passed into AddAccounts request")
|
||||
}
|
||||
|
||||
if len(accountIds) == 0 {
|
||||
return nil, errors.New("empty accountIds passed into AddAccounts request")
|
||||
}
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.New("nil client")
|
||||
}
|
||||
@@ -359,6 +361,7 @@ func (c *Client) AddAccounts(ctx context.Context, id string, version uint32, acc
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["account_ids"] = accountIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("users/%s:add-accounts", id), opts.postMap, apiOpts...)
|
||||
@@ -424,6 +427,7 @@ func (c *Client) SetAccounts(ctx context.Context, id string, version uint32, acc
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["account_ids"] = accountIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("users/%s:set-accounts", id), opts.postMap, apiOpts...)
|
||||
@@ -461,9 +465,11 @@ func (c *Client) RemoveAccounts(ctx context.Context, id string, version uint32,
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("empty id value passed into RemoveAccounts request")
|
||||
}
|
||||
|
||||
if len(accountIds) == 0 {
|
||||
return nil, errors.New("empty accountIds passed into RemoveAccounts request")
|
||||
}
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.New("nil client")
|
||||
}
|
||||
@@ -491,6 +497,7 @@ func (c *Client) RemoveAccounts(ctx context.Context, id string, version uint32,
|
||||
}
|
||||
|
||||
opts.postMap["version"] = version
|
||||
|
||||
opts.postMap["account_ids"] = accountIds
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("users/%s:remove-accounts", id), opts.postMap, apiOpts...)
|
||||
|
||||
Reference in new issue
Block a user