From 11f640a0f8b1274252670e7d89970336a83cd8b5 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Tue, 5 May 2020 14:13:08 -0400 Subject: [PATCH] Fix compilation after Id changing --- api/hosts/create.go | 8 ++++---- api/internal/genapi/create.go | 4 ++-- internal/cmd/commands/hosts/host_create.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/hosts/create.go b/api/hosts/create.go index d7eba91f3..e9b995735 100644 --- a/api/hosts/create.go +++ b/api/hosts/create.go @@ -12,11 +12,11 @@ func (s HostCatalog) CreateHost(ctx context.Context, host *Host) (*Host, *api.Er if s.Client == nil { return nil, nil, fmt.Errorf("nil client in CreateHost request") } - if s.Id == nil || *s.Id == "" { + 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) + 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) } @@ -39,11 +39,11 @@ func (s HostCatalog) CreateHostSet(ctx context.Context, hostset *HostSet) (*Host if s.Client == nil { return nil, nil, fmt.Errorf("nil client in CreateHostSet request") } - if s.Id == nil || *s.Id == "" { + 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) + 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) } diff --git a/api/internal/genapi/create.go b/api/internal/genapi/create.go index 2c9f153a0..35e542cd9 100644 --- a/api/internal/genapi/create.go +++ b/api/internal/genapi/create.go @@ -70,11 +70,11 @@ func (s {{ .BaseType }}) Create{{ .TargetType }}(ctx context.Context, {{ .LowerT if s.Client == nil { return nil, nil, fmt.Errorf("nil client in Create{{ .TargetType }} request") } - if s.Id == nil || *s.Id == "" { + if s.Id == "" { return nil, nil, fmt.Errorf("missing catalog ID in Create{{ .TargetType }} request") } - req, err := s.Client.NewRequest(ctx, "{{ .Verb }}", fmt.Sprintf("{{ .Path }}", *s.Id), {{ .LowerTargetType }}) + req, err := s.Client.NewRequest(ctx, "{{ .Verb }}", fmt.Sprintf("{{ .Path }}", s.Id), {{ .LowerTargetType }}) if err != nil { return nil, nil, fmt.Errorf("error creating Create{{ .TargetType }} request: %w", err) } diff --git a/internal/cmd/commands/hosts/host_create.go b/internal/cmd/commands/hosts/host_create.go index 858e20816..1f9049ed4 100644 --- a/internal/cmd/commands/hosts/host_create.go +++ b/internal/cmd/commands/hosts/host_create.go @@ -113,7 +113,7 @@ func (c *CreateCommand) Run(args []string) int { catalog := &hosts.HostCatalog{ Client: client, - Id: api.String(c.flagCatalogId), + Id: c.flagCatalogId, } host := &hosts.Host{