diff --git a/internal/entities/command_search.go b/internal/entities/command_search.go index 673cb0d8c..13a6d6f63 100644 --- a/internal/entities/command_search.go +++ b/internal/entities/command_search.go @@ -2,6 +2,7 @@ package entities import ( "context" + "strconv" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -26,9 +27,9 @@ The search command performs a search for New Relic entities. Example: "newrelic entity search --name= --type= --domain= --tags=tagKey1:tagValue2,tagKey2:tagValue2", PreRun: client.RequireClient, Run: func(cmd *cobra.Command, args []string) { - if entityName == "" && entityType == "" && entityAlertSeverity == "" && entityDomain == "" && len(entityTags) == 0 { + if entityName == "" && entityType == "" && entityAlertSeverity == "" && entityDomain == "" && len(entityTags) == 0 && entityReporting == "" { utils.LogIfError(cmd.Help()) - log.Fatal("one of --name, --type, --alert-severity, --domain, or --tags is required") + log.Fatal("one of --name, --type, --alert-severity, --domain, --reporting, or --tags is required") } tags, err := entities.ConvertTagsToMap(entityTags) @@ -43,6 +44,12 @@ The search command performs a search for New Relic entities. IsCaseSensitive: entitySearchCaseSensitive, } + if entityReporting != "" { + r, err := strconv.ParseBool(entityReporting) + utils.LogIfFatal(err) + searchParams.IsReporting = &r + } + query := entities.BuildEntitySearchNrqlQuery(searchParams) results, err := client.NRClient.Entities.GetEntitySearchByQueryWithContext(context.Background(),