// Code generated by "make api"; DO NOT EDIT. package hosts import ( "context" "fmt" "github.com/hashicorp/watchtower/api" ) func (s HostCatalog) ReadHostCatalog(ctx context.Context, id string) (*HostCatalog, *api.Error, error) { if id == "" { return nil, nil, fmt.Errorf("empty ID value passed into ReadHostCatalog request") } if s.Client == nil { return nil, nil, fmt.Errorf("nil client in ReadHostCatalog request") } var opts []api.Option if s.Scope.Id != "" { // If it's explicitly set here, override anything that might be in the // client opts = append(opts, api.WithScopeId(s.Scope.Id)) } req, err := s.Client.NewRequest(ctx, "GET", fmt.Sprintf("%s/%s", "host-catalogs", id), nil, opts...) if err != nil { return nil, nil, fmt.Errorf("error creating ReadHostCatalog request: %w", err) } resp, err := s.Client.Do(req) if err != nil { return nil, nil, fmt.Errorf("error performing client request during ReadHostCatalog call: %w", err) } target := new(HostCatalog) apiErr, err := resp.Decode(target) if err != nil { return nil, nil, fmt.Errorf("error decoding ReadHostCatalog repsonse: %w", err) } target.Client = s.Client return target, apiErr, nil }