feat(joyent-cp-gql-schema): add nested queries to more fields

- also, fix identation
 - remove redundant query type
This commit is contained in:
Sérgio Ramos 2017-06-07 15:10:25 +01:00 committed by Judit Greskovits
parent 6ab74d4216
commit ebec51b965

View File

@ -1,100 +1,100 @@
scalar Date scalar Date
scalar Object scalar Object
type Portal { type Portal {
id: ID! id: ID!
user: User! user: User!
datacenter: Datacenter! datacenter: Datacenter!
deploymentGroups: [DeploymentGroup] deploymentGroups(name: String, slug: String): [DeploymentGroup]
} }
type User { type User {
id: ID! id: ID!
firstName: String! firstName: String!
lastName: String! lastName: String!
email: String! email: String!
login: String! login: String!
} }
type DeploymentGroup { type DeploymentGroup {
id: ID! id: ID!
name: String! name: String!
slug: String slug: String
services(slug: String): [Service] services(name: String, slug: String, parentId: ID): [Service]
version: Version version: Version
history: [Version] history: [Version]
} }
type ServiceScale { type ServiceScale {
id: ID! id: ID!
serviceName: String! serviceName: String!
replicas: Int! replicas: Int!
} }
enum ConvergenceActionType { enum ConvergenceActionType {
NOOP NOOP
CREATE CREATE
RECREATE RECREATE
START START
} }
type ConvergenceAction { type ConvergenceAction {
id: String! id: ID!
type: ConvergenceActionType! type: ConvergenceActionType!
service: String! # service name service: String! # service name
machines: [String]! # instance machine ids machines: [String]! # instance machine ids
} }
type StateConvergencePlan { type StateConvergencePlan {
id: String! id: ID!
running: Boolean! running: Boolean!
actions: [ConvergenceAction]! actions(type: ConvergenceActionType, service: String): [ConvergenceAction]!
} }
type Version { type Version {
created: Date! # Either Int or define scalar created: Date! # Either Int or define scalar
manifest: Manifest! manifest: Manifest!
scale: [ServiceScale]! scale(serviceName: String): [ServiceScale]!
plan: StateConvergencePlan plan(running: Boolean): StateConvergencePlan
} }
enum ManifestType { enum ManifestType {
COMPOSE COMPOSE
MARIPOSA MARIPOSA
} }
enum ManifestFormat { enum ManifestFormat {
JSON JSON
YAML YAML
} }
type Manifest { type Manifest {
id: String! id: ID!
created: Date! created: Date!
type: ManifestType! type: ManifestType!
format: ManifestFormat! format: ManifestFormat!
raw: String! raw: String!
obj: Object! obj: Object!
} }
# immutable # immutable
type Service { type Service {
id: String! # unique id for db row id: ID! # unique id for db row
hash: String! # unique id for version of service hash: String! # unique id for version of service
name: String! # human readable name name: String! # human readable name
slug: String! slug: String!
instances: [Instance]! instances(name: String, machineId: ID, status: InstanceStatus): [Instance]!
# metrics: [MetricType]! # metrics: [MetricType]!
currentMetrics: [CurrentMetric]! currentMetrics: [CurrentMetric]!
connections: [String!] # list of serviceIds connections: [String!] # list of serviceIds
parent: ID # parent service id parent: ID # parent service id
package: Package! # we don't have this in current mock data, package: Package! # we don't have this in current mock data,
environment: [Environment] environment: [Environment]
} }
# for metrics max / min (I guess) # for metrics max / min (I guess)
type Package { type Package {
id: ID! id: ID!
name: String! name: String!
type: String! type: String!
@ -105,80 +105,63 @@
vcpus: Int! vcpus: Int!
version: String! version: String!
group: String! group: String!
} }
# environment variables # environment variables
type Environment { type Environment {
name: String! name: String!
value: String! value: String!
} }
enum InstanceStatus { enum InstanceStatus {
CREATED CREATED
RESTARTING RESTARTING
RUNNING RUNNING
PAUSED PAUSED
EXITED EXITED
DELETED DELETED
} }
type Instance { type Instance {
id: String! id: ID!
name: String! name: String!
machineId: String! machineId: ID!
status: InstanceStatus! status: InstanceStatus!
# metrics: [InstanceMetric]! # metrics: [InstanceMetric]!
} }
type Datacenter { type Datacenter {
id: String! id: ID!
url: String! url: String!
name: String! name: String!
region: String! region: String!
} }
type InstanceMetric { type InstanceMetric {
type: MetricType! type: MetricType!
data: [MetricData]! data: [MetricData]!
} }
type CurrentMetric { type CurrentMetric {
name: String! name: String!
value: Float! value: Float!
measurement: String! measurement: String!
} }
type MetricType { type MetricType {
id: String! id: ID!
name: String! name: String!
id: String! id: ID!
} }
type MetricData { type MetricData {
timestamp: Int! timestamp: Int!
value: Float! value: Float!
} }
# Need to review queries # we probably wont use some of these queries or arguments
type Query { # but this way we expose the entire db through gql
portal: Portal type Query {
deploymentGroups: [DeploymentGroup]
deploymentGroup(id: String, slug: String): DeploymentGroup
services(deploymentGroupId: String, deploymentGroupSlug: String): [Service]
service(id: String, slug: String): Service
instances(serviceId: String, serviceSlug: String): [Instance]
instance(id: String, machineId: String): Instance
metricTypes: [MetricType]
metricData(instanceId: String!, metricType: String!, from: Date!, to: Date!): [InstanceMetric]!
package: Package
datacenters: [Datacenter]
# tmp test
instanceMetric: InstanceMetric!
}
# we probably wont use some of these queries or arguments
# but this way we expose the entire db through gql
type Query {
portal: Portal portal: Portal
user: User user: User
deploymentGroups(name: String, slug: String): [DeploymentGroup] deploymentGroups(name: String, slug: String): [DeploymentGroup]
@ -201,9 +184,9 @@
instance(id: ID!): Instance instance(id: ID!): Instance
datacenter(id: ID, region: String): Datacenter datacenter(id: ID, region: String): Datacenter
datacenters: [Datacenter] datacenters: [Datacenter]
} }
type Mutation { type Mutation {
createDeploymentGroup(name: String!) : DeploymentGroup createDeploymentGroup(name: String!) : DeploymentGroup
updateDeploymentGroup(id: ID!, name: String!) : DeploymentGroup updateDeploymentGroup(id: ID!, name: String!) : DeploymentGroup
@ -220,4 +203,4 @@
restartInstances(ids: [ID]!) : [Instance] restartInstances(ids: [ID]!) : [Instance]
# reprovision() ??? # reprovision() ???
} }