Auth methods CLI (#277)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-08-18 17:46:34 -04:00
1 parent 041e1f9fd3
commit adfc5681be
41 files changed
+951 -192

No files matched your search

+1 -3
View File
@@ -38,13 +38,11 @@ func (c *HostsClient) Create(ctx context.Context, hostCatalogId string, opt ...O
if hostCatalogId == "" {
return nil, nil, fmt.Errorf("empty hostCatalogId value passed into Create request")
}
opts, apiOpts := getOpts(opt...)
if c.client == nil {
return nil, nil, fmt.Errorf("nil client")
}
opts, apiOpts := getOpts(opt...)
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("host-catalogs/%s/hosts", hostCatalogId), opts.valueMap, apiOpts...)
if err != nil {
return nil, nil, fmt.Errorf("error creating Create request: %w", err)
+7 -3
View File
@@ -34,12 +34,16 @@ func NewHostCatalogsClient(c *api.Client) *HostCatalogsClient {
return &HostCatalogsClient{client: c}
}
func (c *HostCatalogsClient) Create(ctx context.Context, opt ...Option) (*HostCatalog, *api.Error, error) {
func (c *HostCatalogsClient) Create(ctx context.Context, resourceType string, opt ...Option) (*HostCatalog, *api.Error, error) {
opts, apiOpts := getOpts(opt...)
if c.client == nil {
return nil, nil, fmt.Errorf("nil client")
}
opts, apiOpts := getOpts(opt...)
if resourceType == "" {
return nil, nil, fmt.Errorf("empty resourceType value passed into Create request")
} else {
opts.valueMap["type"] = resourceType
}
req, err := c.client.NewRequest(ctx, "POST", "host-catalogs", opts.valueMap, apiOpts...)
if err != nil {
+1 -3
View File
@@ -39,13 +39,11 @@ func (c *HostSetsClient) Create(ctx context.Context, hostCatalogId string, opt .
if hostCatalogId == "" {
return nil, nil, fmt.Errorf("empty hostCatalogId value passed into Create request")
}
opts, apiOpts := getOpts(opt...)
if c.client == nil {
return nil, nil, fmt.Errorf("nil client")
}
opts, apiOpts := getOpts(opt...)
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("host-catalogs/%s/host-sets", hostCatalogId), opts.valueMap, apiOpts...)
if err != nil {
return nil, nil, fmt.Errorf("error creating Create request: %w", err)