---
# System prepended metadata

title: Recipe Service <-> newrelic-cli workflow
tags: [New Relic]

---

###### tags: `New Relic`

# Recipe Service <-> newrelic-cli workflow

## Proposal

1. newrelic-cli gets HostInfo, perhaps like/from [NrDiag](https://github.com/newrelic/newrelic-diagnostics-cli/blob/a8095808557de2ade621169fa4a5e1c4de4ff739/tasks/base/env/hostInfoHelpers.go#L14-L24)
1. [newrelic-cli queries for a potential infrastructure agent recipe](#Infra-Agent-Query)
1. Does user want us to inspect things and make recommendations?
1. If "yes" newrelic-cli runs ProcessDetection
1. [newrelic-cli queries recipe service for recommendations passing along the ProcessDetection info](#Recommendations-Query)


## Queries

### Infra Agent Query

```graphql=
query {
  docs {
    recipeSearch({
      name: "Infrastructure Agent Installer",

      # An implementation of the InstallTarget interface
      installTarget: {
        type: "VM"
        OS: "linux"
        Platform: "ubuntu"
        PlatformFamily: "debian"
        PlatformVersion: "17.10"
        KernelVersion: "1.0.0"
      }
    })
  }
}
```

### Recommendations Query

```graphql=
query {
  docs {
    recommendations(
      installTarget: {
        type: "VM"
        os: "linux"
        platform: "ubuntu"
        platformFamily: "debian"
        platformVersion: "17.10"
        kernelVersion: "1.0.0"
      },

      # Change details to an interface and have an implementation of "process"
      # Stay up to date with Chris's progress
      details: [
        { name: "foo" },
        { name: "bar" }
      ]
    )
  }
}
```

### Overall Schema

```graphql=
# For finding the correct infrastructure agent recipe
query {
  recipeSearch(criteria: RecipeSearchCriteria): RecipeSearchResults
}

type RecipeSearchCriteria {
  name: string
  installTarget: InstallTargetType
}

interface InstallTargetType {
  type: INSTALL_TYPE_ENUM
  ...OtherSharedInstallTargetData
}

type Host implements InstallTarget {
  os:                   OS_ENUM
  platform:             string
  platformFamily:       string
  platformVersion:      string
  kernelVersion:        string
  kernelArch:           string
}

type RepositoryIntegration implements InstallTarget {
  language: String
}

type CloudIntegration implements InstallTarget {
  provider: CloudProvider
  service: CloudProviderService
  
}

# TO DO - Make this an interface and have AWS/Azure/Google implement it
type CloudProvider {
 name: "AWS"
 region: "us-east-1"
}

type CloudProviderService {
  name: "LAMBDA"
}

enum PLATFORM {
  UBUNTU
  SUSE
}

enum INSTALL_TYPE_ENUM {
  HOST
  APPLICATION

  DOCKER
  KUBERNETES
  CLOUD
  SERVERLESS
}

enum OS_ENUM {
  WINDOWS
  DARWIN
  LINUX
}

```




Questions:

- Should we have one query space, or two? Do we need to keep both `recipeSearch` and `recommendations`? i.e. Would `recommendations()` return the Infra Agent for example?
- Is APM/repository investigation part of MVP? Will this be toggled by flag or different command with the newrelic-cli or determined by the newrelic-cli?