Minor fixes and first API test changeover (#243)
This commit is contained in:
1 parent
d74e30d94a
commit
df4730b1a0
16 files changed
+167
-145
No files matched your search
@@ -22,15 +22,15 @@ type Host struct {
|
||||
Address string `json:"address,omitempty"`
|
||||
}
|
||||
|
||||
type hostClient struct {
|
||||
type hostsClient struct {
|
||||
client *api.Client
|
||||
}
|
||||
|
||||
func NewHostClient(c *api.Client) *hostClient {
|
||||
return &hostClient{client: c}
|
||||
func NewHostsClient(c *api.Client) *hostsClient {
|
||||
return &hostsClient{client: c}
|
||||
}
|
||||
|
||||
func (c *hostClient) Create(ctx context.Context, hostCatalogId string, opt ...Option) (*Host, *api.Error, error) {
|
||||
func (c *hostsClient) Create(ctx context.Context, hostCatalogId string, opt ...Option) (*Host, *api.Error, error) {
|
||||
if hostCatalogId == "" {
|
||||
return nil, nil, fmt.Errorf("empty hostCatalogId value passed into Create request")
|
||||
}
|
||||
@@ -60,7 +60,7 @@ func (c *hostClient) Create(ctx context.Context, hostCatalogId string, opt ...Op
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *hostClient) Read(ctx context.Context, hostCatalogId string, hostId string, opt ...Option) (*Host, *api.Error, error) {
|
||||
func (c *hostsClient) Read(ctx context.Context, hostCatalogId string, hostId string, opt ...Option) (*Host, *api.Error, error) {
|
||||
if hostCatalogId == "" {
|
||||
return nil, nil, fmt.Errorf("empty hostCatalogId value passed into Read request")
|
||||
}
|
||||
@@ -94,7 +94,7 @@ func (c *hostClient) Read(ctx context.Context, hostCatalogId string, hostId stri
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *hostClient) Update(ctx context.Context, hostCatalogId string, hostId string, version uint32, opt ...Option) (*Host, *api.Error, error) {
|
||||
func (c *hostsClient) Update(ctx context.Context, hostCatalogId string, hostId string, version uint32, opt ...Option) (*Host, *api.Error, error) {
|
||||
if hostCatalogId == "" {
|
||||
return nil, nil, fmt.Errorf("empty hostCatalogId value passed into Update request")
|
||||
}
|
||||
@@ -126,7 +126,7 @@ func (c *hostClient) Update(ctx context.Context, hostCatalogId string, hostId st
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *hostClient) Delete(ctx context.Context, hostCatalogId string, hostId string, opt ...Option) (bool, *api.Error, error) {
|
||||
func (c *hostsClient) Delete(ctx context.Context, hostCatalogId string, hostId string, opt ...Option) (bool, *api.Error, error) {
|
||||
if hostCatalogId == "" {
|
||||
return false, nil, fmt.Errorf("empty hostCatalogId value passed into Delete request")
|
||||
}
|
||||
@@ -163,7 +163,7 @@ func (c *hostClient) Delete(ctx context.Context, hostCatalogId string, hostId st
|
||||
return target.Existed, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *hostClient) List(ctx context.Context, hostCatalogId string, opt ...Option) ([]*Host, *api.Error, error) {
|
||||
func (c *hostsClient) List(ctx context.Context, hostCatalogId string, opt ...Option) ([]*Host, *api.Error, error) {
|
||||
if hostCatalogId == "" {
|
||||
return nil, nil, fmt.Errorf("empty hostCatalogId value passed into List request")
|
||||
}
|
||||
|
||||
@@ -22,15 +22,15 @@ type HostCatalog struct {
|
||||
Attributes map[string]interface{} `json:"attributes,omitempty"`
|
||||
}
|
||||
|
||||
type hostcatalogClient struct {
|
||||
type hostcatalogsClient struct {
|
||||
client *api.Client
|
||||
}
|
||||
|
||||
func NewHostCatalogClient(c *api.Client) *hostcatalogClient {
|
||||
return &hostcatalogClient{client: c}
|
||||
func NewHostCatalogsClient(c *api.Client) *hostcatalogsClient {
|
||||
return &hostcatalogsClient{client: c}
|
||||
}
|
||||
|
||||
func (c *hostcatalogClient) Create(ctx context.Context, opt ...Option) (*HostCatalog, *api.Error, error) {
|
||||
func (c *hostcatalogsClient) Create(ctx context.Context, opt ...Option) (*HostCatalog, *api.Error, error) {
|
||||
if c.client == nil {
|
||||
return nil, nil, fmt.Errorf("nil client")
|
||||
}
|
||||
@@ -56,7 +56,7 @@ func (c *hostcatalogClient) Create(ctx context.Context, opt ...Option) (*HostCat
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *hostcatalogClient) Read(ctx context.Context, hostCatalogId string, opt ...Option) (*HostCatalog, *api.Error, error) {
|
||||
func (c *hostcatalogsClient) Read(ctx context.Context, hostCatalogId string, opt ...Option) (*HostCatalog, *api.Error, error) {
|
||||
if hostCatalogId == "" {
|
||||
return nil, nil, fmt.Errorf("empty hostCatalogId value passed into Read request")
|
||||
}
|
||||
@@ -86,7 +86,7 @@ func (c *hostcatalogClient) Read(ctx context.Context, hostCatalogId string, opt
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *hostcatalogClient) Update(ctx context.Context, hostCatalogId string, version uint32, opt ...Option) (*HostCatalog, *api.Error, error) {
|
||||
func (c *hostcatalogsClient) Update(ctx context.Context, hostCatalogId string, version uint32, opt ...Option) (*HostCatalog, *api.Error, error) {
|
||||
if hostCatalogId == "" {
|
||||
return nil, nil, fmt.Errorf("empty hostCatalogId value passed into Update request")
|
||||
}
|
||||
@@ -115,7 +115,7 @@ func (c *hostcatalogClient) Update(ctx context.Context, hostCatalogId string, ve
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *hostcatalogClient) Delete(ctx context.Context, hostCatalogId string, opt ...Option) (bool, *api.Error, error) {
|
||||
func (c *hostcatalogsClient) Delete(ctx context.Context, hostCatalogId string, opt ...Option) (bool, *api.Error, error) {
|
||||
if hostCatalogId == "" {
|
||||
return false, nil, fmt.Errorf("empty hostCatalogId value passed into Delete request")
|
||||
}
|
||||
@@ -148,7 +148,7 @@ func (c *hostcatalogClient) Delete(ctx context.Context, hostCatalogId string, op
|
||||
return target.Existed, apiErr, nil
|
||||
}
|
||||
|
||||
func (c *hostcatalogClient) List(ctx context.Context, opt ...Option) ([]*HostCatalog, *api.Error, error) {
|
||||
func (c *hostcatalogsClient) List(ctx context.Context, opt ...Option) ([]*HostCatalog, *api.Error, error) {
|
||||
if c.client == nil {
|
||||
return nil, nil, fmt.Errorf("nil client")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user