Rename generated files to make them obvious
This commit is contained in:
1 parent
050b914447
commit
828fee20a1
10 files changed
+8
-8
No files matched your search
@@ -0,0 +1,63 @@
|
||||
// Code generated by "make api"; DO NOT EDIT.
|
||||
package hosts
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/watchtower/api"
|
||||
)
|
||||
|
||||
func (s HostCatalog) CreateHost(ctx context.Context, host *Host) (*Host, *api.Error, error) {
|
||||
if s.Client == nil {
|
||||
return nil, nil, fmt.Errorf("nil client in CreateHost request")
|
||||
}
|
||||
if s.Id == "" {
|
||||
return nil, nil, fmt.Errorf("missing catalog ID in CreateHost request")
|
||||
}
|
||||
|
||||
req, err := s.Client.NewRequest(ctx, "PUT", fmt.Sprintf("host-catalogs/%s/hosts", s.Id), host)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error creating CreateHost request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := s.Client.Do(req)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error performing client request during CreateHost call: %w", err)
|
||||
}
|
||||
|
||||
target := new(Host)
|
||||
apiErr, err := resp.Decode(target)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error decoding CreateHost repsonse: %w", err)
|
||||
}
|
||||
|
||||
return target, apiErr, nil
|
||||
}
|
||||
|
||||
func (s HostCatalog) CreateHostSet(ctx context.Context, hostset *HostSet) (*HostSet, *api.Error, error) {
|
||||
if s.Client == nil {
|
||||
return nil, nil, fmt.Errorf("nil client in CreateHostSet request")
|
||||
}
|
||||
if s.Id == "" {
|
||||
return nil, nil, fmt.Errorf("missing catalog ID in CreateHostSet request")
|
||||
}
|
||||
|
||||
req, err := s.Client.NewRequest(ctx, "PUT", fmt.Sprintf("host-catalogs/%s/host-sets", s.Id), hostset)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error creating CreateHostSet request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := s.Client.Do(req)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error performing client request during CreateHostSet call: %w", err)
|
||||
}
|
||||
|
||||
target := new(HostSet)
|
||||
apiErr, err := resp.Decode(target)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error decoding CreateHostSet repsonse: %w", err)
|
||||
}
|
||||
|
||||
return target, apiErr, nil
|
||||
}
|
||||
Reference in new issue
Block a user