Update queries and add mutations to schema

This commit is contained in:
JUDIT GRESKOVITS 2017-05-17 11:45:19 +01:00 committed by Sérgio Ramos
parent b3463e7dab
commit 4574e8b007

View File

@ -8,23 +8,22 @@ scalar Object
type Portal { type Portal {
username: String! username: String!
host: String! # dockerhost
datacenter: Datacenter! datacenter: Datacenter!
deploymentGroups: [DeploymentGroup]! deploymentGroups: [DeploymentGroup]!
} }
type DeploymentGroup { type DeploymentGroup {
uuid: String! uuid: ID!
name: String! name: String!
slug: String! slug: String!
datacenter: Datacenter!
services: [Service]! services: [Service]!
version: Version! version: Version!
history: [Version]! history: [Version]!
} }
type ServiceScale { type ServiceScale {
name: String! uuid: ID!
serviceName: String!
replicas: Int! replicas: Int!
} }
@ -49,27 +48,31 @@ enum ConvergenceActionType {
} }
type Version { type Version {
created: Date! created: Date! # Either Int or define scalar
manifest: Manifest! manifest: Manifest!
scale: [ServiceScale]! scale: [ServiceScale]!
plan: StateConvergencePlan plan: StateConvergencePlan
} }
enum ManifestType {
COMPOSE
MARIPOSA
}
enum ManifestFormat {
JSON
YAML
}
type Manifest { type Manifest {
uuid: String! uuid: String!
created: Date! created: Date!
type: String! type: ManifestType!
format: String! format: ManifestFormat!
raw: String! raw: String!
obj: Object! obj: Object!
} }
type CurrentMetric {
name: String!
value: Float!
measurement: String!
}
# immutable # immutable
type Service { type Service {
uuid: String! # unique id for db row uuid: String! # unique id for db row
@ -80,22 +83,22 @@ type Service {
# metrics: [MetricType]! # metrics: [MetricType]!
currentMetrics: [CurrentMetric]! currentMetrics: [CurrentMetric]!
connections: [String!] # list of serviceUuids connections: [String!] # list of serviceUuids
parent: String # parent service uuid parent: ID # parent service uuid
package: Package! # we don't have this in current mock data package: Package! # we don't have this in current mock data
} }
type MetricType {
uuid: String!
name: String!
id: String!
}
# for metrics max / min (I guess) # for metrics max / min (I guess)
type Package { type Package {
uuid: ID!
name: String!
type: String! type: String!
memory: Int! memory: Float!
disk: Int! disk: Float!
vCPUs: Float! # This should be a number / double, not an int swap: Float!
lwps: Int!
vcpus: Int!
version: String!
group: String!
} }
enum InstanceStatus { enum InstanceStatus {
@ -115,22 +118,34 @@ type Instance {
# metrics: [InstanceMetric]! # metrics: [InstanceMetric]!
} }
type Datacenter {
uuid: String!
# name: String! # Do we have 'official' human readable names?
region: String!
}
type InstanceMetric { type InstanceMetric {
type: MetricType! type: MetricType!
data: [MetricData]! data: [MetricData]!
} }
type CurrentMetric {
name: String!
value: Float!
measurement: String!
}
type MetricType {
uuid: String!
name: String!
id: String!
}
type MetricData { type MetricData {
timestamp: Int! timestamp: Int!
value: Float! value: Float!
} }
type Datacenter {
uuid: String!
slug: String!
location: String!
}
# Need to review queries # Need to review queries
type Query { type Query {
portal: Portal portal: Portal
@ -148,6 +163,49 @@ type Query {
instanceMetric: InstanceMetric! 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
deploymentGroups(name: String, slug: String): [DeploymentGroup]
deploymentGroup(uuid: ID, name: String, slug: String): DeploymentGroup # WE ARE DISCUSSING THIS
serviceScales(serviceName: String, versionUuid: ID): [ServiceScale]
serviceScale(uuid: ID!): ServiceScale
convergenceActions(type: ConvergenceActionType, service: String, versionUuid: ID): [ConvergenceAction]
convergenceAction(uuid: ID!): ConvergenceAction
stateConvergencePlans(running: Boolean, versionUuid: ID): [StateConvergencePlan]
stateConvergencePlan(uuid: ID!): StateConvergencePlan
versions(manifestUuid: ID, deploymentGroupUuid: ID): [Version]
version(uuid: ID, manifestUuid: ID): Version # WE ARE DISCUSSING THIS
manifests(type: String, deploymentGroupUuid: ID): [Manifest]
manifest(uuid: ID!): Manifest
services(name: String, slug: String, parent: ID, deploymentGroupUuid: ID): [Service]
service(uuid: ID, hash: ID): Service # WE ARE DISCUSSING THIS
packages(name: String, type: String, memory: Int, disk: Int, swap: Int, lwps: Int, vcpus: Int, version: String, group: String): [Package]
package(uuid: ID!): Package
instances(name: String!, machineId: ID, status: InstanceStatus, serviceUuid: ID, deploymentGroupUuid: ID): [Instance]
instance(uuid: ID!): Instance
datacenter(uuid: ID, region: String): Datacenter
}
type Mutation {
createDeploymentGroup(name: String!)
updateDeploymentGroup(uuid: ID!, name: String!)
provisionManifest(deploymentGroupUuid: ID!, type: ManifestType!, format: ManifestFormat!, raw: String!)
scale(service: ID!, replicas: Int!)
stopService(uuid: String!)
startService(uuid: String!)
restartService(uuid: String!)
stopInstances(uuids: [String]!)
startInstances(uuids: [String]!)
restartInstances(uuids: [String]!)
# reprovision() ???
}
`; `;
export default makeExecutableSchema({ export default makeExecutableSchema({