Separate accounts/host catalogs/host sets into their own packages (#311)
This commit is contained in:
1 parent
936c970635
commit
17ecb6f2ce
64 files changed
+2298
-2265
No files matched your search
+14
-14
@@ -29,15 +29,15 @@ type Role struct {
|
||||
Grants []*Grant `json:"grants,omitempty"`
|
||||
}
|
||||
|
||||
type RolesClient struct {
|
||||
type Client struct {
|
||||
client *api.Client
|
||||
}
|
||||
|
||||
func NewRolesClient(c *api.Client) *RolesClient {
|
||||
return &RolesClient{client: c}
|
||||
func NewClient(c *api.Client) *Client {
|
||||
return &Client{client: c}
|
||||
}
|
||||
|
||||
func (c *RolesClient) Create(ctx context.Context, opt ...Option) (*Role, *api.Error, error) {
|
||||
func (c *Client) Create(ctx context.Context, opt ...Option) (*Role, *api.Error, error) {
|
||||
opts, apiOpts := getOpts(opt...)
|
||||
if c.client == nil {
|
||||
return nil, nil, fmt.Errorf("nil client")
|
||||
@@ -72,7 +72,7 @@ func (c *RolesClient) Create(ctx context.Context, opt ...Option) (*Role, *api.Er
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *RolesClient) Read(ctx context.Context, roleId string, opt ...Option) (*Role, *api.Error, error) {
|
||||
func (c *Client) Read(ctx context.Context, roleId string, opt ...Option) (*Role, *api.Error, error) {
|
||||
if roleId == "" {
|
||||
return nil, nil, fmt.Errorf("empty roleId value passed into Read request")
|
||||
}
|
||||
@@ -112,7 +112,7 @@ func (c *RolesClient) Read(ctx context.Context, roleId string, opt ...Option) (*
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *RolesClient) Update(ctx context.Context, roleId string, version uint32, opt ...Option) (*Role, *api.Error, error) {
|
||||
func (c *Client) Update(ctx context.Context, roleId string, version uint32, opt ...Option) (*Role, *api.Error, error) {
|
||||
if roleId == "" {
|
||||
return nil, nil, fmt.Errorf("empty roleId value passed into Update request")
|
||||
}
|
||||
@@ -170,7 +170,7 @@ func (c *RolesClient) Update(ctx context.Context, roleId string, version uint32,
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *RolesClient) Delete(ctx context.Context, roleId string, opt ...Option) (bool, *api.Error, error) {
|
||||
func (c *Client) Delete(ctx context.Context, roleId string, opt ...Option) (bool, *api.Error, error) {
|
||||
if roleId == "" {
|
||||
return false, nil, fmt.Errorf("empty roleId value passed into Delete request")
|
||||
}
|
||||
@@ -213,7 +213,7 @@ func (c *RolesClient) Delete(ctx context.Context, roleId string, opt ...Option)
|
||||
return target.Existed, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *RolesClient) List(ctx context.Context, opt ...Option) ([]*Role, *api.Error, error) {
|
||||
func (c *Client) List(ctx context.Context, opt ...Option) ([]*Role, *api.Error, error) {
|
||||
if c.client == nil {
|
||||
return nil, nil, fmt.Errorf("nil client")
|
||||
}
|
||||
@@ -252,7 +252,7 @@ func (c *RolesClient) List(ctx context.Context, opt ...Option) ([]*Role, *api.Er
|
||||
return target.Items, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *RolesClient) AddGrants(ctx context.Context, roleId string, version uint32, grantStrings []string, opt ...Option) (*Role, *api.Error, error) {
|
||||
func (c *Client) AddGrants(ctx context.Context, roleId string, version uint32, grantStrings []string, opt ...Option) (*Role, *api.Error, error) {
|
||||
if roleId == "" {
|
||||
return nil, nil, fmt.Errorf("empty roleId value passed into AddGrants request")
|
||||
}
|
||||
@@ -314,7 +314,7 @@ func (c *RolesClient) AddGrants(ctx context.Context, roleId string, version uint
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *RolesClient) AddPrincipals(ctx context.Context, roleId string, version uint32, principalIds []string, opt ...Option) (*Role, *api.Error, error) {
|
||||
func (c *Client) AddPrincipals(ctx context.Context, roleId string, version uint32, principalIds []string, opt ...Option) (*Role, *api.Error, error) {
|
||||
if roleId == "" {
|
||||
return nil, nil, fmt.Errorf("empty roleId value passed into AddPrincipals request")
|
||||
}
|
||||
@@ -376,7 +376,7 @@ func (c *RolesClient) AddPrincipals(ctx context.Context, roleId string, version
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *RolesClient) SetGrants(ctx context.Context, roleId string, version uint32, grantStrings []string, opt ...Option) (*Role, *api.Error, error) {
|
||||
func (c *Client) SetGrants(ctx context.Context, roleId string, version uint32, grantStrings []string, opt ...Option) (*Role, *api.Error, error) {
|
||||
if roleId == "" {
|
||||
return nil, nil, fmt.Errorf("empty roleId value passed into SetGrants request")
|
||||
}
|
||||
@@ -441,7 +441,7 @@ func (c *RolesClient) SetGrants(ctx context.Context, roleId string, version uint
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *RolesClient) SetPrincipals(ctx context.Context, roleId string, version uint32, principalIds []string, opt ...Option) (*Role, *api.Error, error) {
|
||||
func (c *Client) SetPrincipals(ctx context.Context, roleId string, version uint32, principalIds []string, opt ...Option) (*Role, *api.Error, error) {
|
||||
if roleId == "" {
|
||||
return nil, nil, fmt.Errorf("empty roleId value passed into SetPrincipals request")
|
||||
}
|
||||
@@ -506,7 +506,7 @@ func (c *RolesClient) SetPrincipals(ctx context.Context, roleId string, version
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *RolesClient) RemoveGrants(ctx context.Context, roleId string, version uint32, grantStrings []string, opt ...Option) (*Role, *api.Error, error) {
|
||||
func (c *Client) RemoveGrants(ctx context.Context, roleId string, version uint32, grantStrings []string, opt ...Option) (*Role, *api.Error, error) {
|
||||
if roleId == "" {
|
||||
return nil, nil, fmt.Errorf("empty roleId value passed into RemoveGrants request")
|
||||
}
|
||||
@@ -568,7 +568,7 @@ func (c *RolesClient) RemoveGrants(ctx context.Context, roleId string, version u
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *RolesClient) RemovePrincipals(ctx context.Context, roleId string, version uint32, principalIds []string, opt ...Option) (*Role, *api.Error, error) {
|
||||
func (c *Client) RemovePrincipals(ctx context.Context, roleId string, version uint32, principalIds []string, opt ...Option) (*Role, *api.Error, error) {
|
||||
if roleId == "" {
|
||||
return nil, nil, fmt.Errorf("empty roleId value passed into RemovePrincipals request")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user