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
@@ -28,7 +28,7 @@ func TestProjects_List(t *testing.T) {
|
||||
org := iam.TestOrg(t, tc.IamRepo())
|
||||
client.SetScopeId(org.GetPublicId())
|
||||
|
||||
scps := scopes.NewScopesClient(client)
|
||||
scps := scopes.NewClient(client)
|
||||
|
||||
pl, apiErr, err := scps.List(tc.Context(), org.GetPublicId())
|
||||
require.NoError(err)
|
||||
@@ -77,7 +77,7 @@ func TestProjects_Crud(t *testing.T) {
|
||||
org, _ := iam.TestScopes(t, tc.IamRepo())
|
||||
client.SetScopeId(org.GetPublicId())
|
||||
|
||||
scps := scopes.NewScopesClient(client)
|
||||
scps := scopes.NewClient(client)
|
||||
|
||||
checkProject := func(step string, s *scopes.Scope, apiErr *api.Error, err error, wantedName string, wantedVersion uint32) {
|
||||
require.NoError(err, step)
|
||||
@@ -130,7 +130,7 @@ func TestProject_Errors(t *testing.T) {
|
||||
org, _ := iam.TestScopes(t, tc.IamRepo())
|
||||
client.SetScopeId(org.GetPublicId())
|
||||
|
||||
scps := scopes.NewScopesClient(client)
|
||||
scps := scopes.NewClient(client)
|
||||
|
||||
createdProj, apiErr, err := scps.Create(tc.Context(), org.GetPublicId())
|
||||
require.NoError(err)
|
||||
|
||||
@@ -23,15 +23,15 @@ type Scope struct {
|
||||
Version uint32 `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
type ScopesClient struct {
|
||||
type Client struct {
|
||||
client *api.Client
|
||||
}
|
||||
|
||||
func NewScopesClient(c *api.Client) *ScopesClient {
|
||||
return &ScopesClient{client: c}
|
||||
func NewClient(c *api.Client) *Client {
|
||||
return &Client{client: c}
|
||||
}
|
||||
|
||||
func (c *ScopesClient) Create(ctx context.Context, scopeId string, opt ...Option) (*Scope, *api.Error, error) {
|
||||
func (c *Client) Create(ctx context.Context, scopeId string, opt ...Option) (*Scope, *api.Error, error) {
|
||||
if scopeId == "" {
|
||||
return nil, nil, fmt.Errorf("empty scopeId value passed into Create request")
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func (c *ScopesClient) Create(ctx context.Context, scopeId string, opt ...Option
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *ScopesClient) Read(ctx context.Context, scopeId string, opt ...Option) (*Scope, *api.Error, error) {
|
||||
func (c *Client) Read(ctx context.Context, scopeId string, opt ...Option) (*Scope, *api.Error, error) {
|
||||
if scopeId == "" {
|
||||
return nil, nil, fmt.Errorf("empty scopeId value passed into Read request")
|
||||
}
|
||||
@@ -111,7 +111,7 @@ func (c *ScopesClient) Read(ctx context.Context, scopeId string, opt ...Option)
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *ScopesClient) Update(ctx context.Context, scopeId string, version uint32, opt ...Option) (*Scope, *api.Error, error) {
|
||||
func (c *Client) Update(ctx context.Context, scopeId string, version uint32, opt ...Option) (*Scope, *api.Error, error) {
|
||||
if scopeId == "" {
|
||||
return nil, nil, fmt.Errorf("empty scopeId value passed into Update request")
|
||||
}
|
||||
@@ -169,7 +169,7 @@ func (c *ScopesClient) Update(ctx context.Context, scopeId string, version uint3
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *ScopesClient) Delete(ctx context.Context, scopeId string, opt ...Option) (bool, *api.Error, error) {
|
||||
func (c *Client) Delete(ctx context.Context, scopeId string, opt ...Option) (bool, *api.Error, error) {
|
||||
if scopeId == "" {
|
||||
return false, nil, fmt.Errorf("empty scopeId value passed into Delete request")
|
||||
}
|
||||
@@ -212,7 +212,7 @@ func (c *ScopesClient) Delete(ctx context.Context, scopeId string, opt ...Option
|
||||
return target.Existed, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *ScopesClient) List(ctx context.Context, scopeId string, opt ...Option) ([]*Scope, *api.Error, error) {
|
||||
func (c *Client) List(ctx context.Context, scopeId string, opt ...Option) ([]*Scope, *api.Error, error) {
|
||||
if scopeId == "" {
|
||||
return nil, nil, fmt.Errorf("empty scopeId value passed into List request")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user