1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-28 14:10:04 +02:00

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,223 +1,206 @@
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!
memory: Float! memory: Float!
disk: Float! disk: Float!
swap: Float! swap: Float!
lwps: Int! lwps: Int!
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] portal: Portal
deploymentGroup(id: String, slug: String): DeploymentGroup user: User
services(deploymentGroupId: String, deploymentGroupSlug: String): [Service] deploymentGroups(name: String, slug: String): [DeploymentGroup]
service(id: String, slug: String): Service deploymentGroup(id: ID, name: String, slug: String): DeploymentGroup
instances(serviceId: String, serviceSlug: String): [Instance] serviceScales(serviceName: String, versionId: ID): [ServiceScale]
instance(id: String, machineId: String): Instance serviceScale(id: ID!): ServiceScale
metricTypes: [MetricType] convergenceActions(type: ConvergenceActionType, service: String, versionId: ID): [ConvergenceAction]
metricData(instanceId: String!, metricType: String!, from: Date!, to: Date!): [InstanceMetric]! convergenceAction(id: ID!): ConvergenceAction
package: Package stateConvergencePlans(running: Boolean, versionId: ID): [StateConvergencePlan]
datacenters: [Datacenter] stateConvergencePlan(id: ID!): StateConvergencePlan
# tmp test versions(manifestId: ID, deploymentGroupId: ID): [Version]
instanceMetric: InstanceMetric! version(id: ID, manifestId: ID): Version
} manifests(type: String, deploymentGroupId: ID): [Manifest]
manifest(id: ID!): Manifest
services(name: String, slug: String, parentId: ID, deploymentGroupId: ID, deploymentGroupSlug: String): [Service]
service(id: ID, hash: ID): Service
packages(name: String, type: String, memory: Int, disk: Int, swap: Int, lwps: Int, vcpus: Int, version: String, group: String): [Package]
package(id: ID!): Package
instances(name: String!, machineId: ID, status: InstanceStatus, serviceId: ID, serviceSlug: String, deploymentGroupId: ID, deploymentGroupSlug: String): [Instance]
instance(id: ID!): Instance
datacenter(id: ID, region: String): Datacenter
datacenters: [Datacenter]
}
# we probably wont use some of these queries or arguments type Mutation {
# but this way we expose the entire db through gql createDeploymentGroup(name: String!) : DeploymentGroup
type Query { updateDeploymentGroup(id: ID!, name: String!) : DeploymentGroup
portal: Portal
user: User
deploymentGroups(name: String, slug: String): [DeploymentGroup]
deploymentGroup(id: ID, name: String, slug: String): DeploymentGroup
serviceScales(serviceName: String, versionId: ID): [ServiceScale]
serviceScale(id: ID!): ServiceScale
convergenceActions(type: ConvergenceActionType, service: String, versionId: ID): [ConvergenceAction]
convergenceAction(id: ID!): ConvergenceAction
stateConvergencePlans(running: Boolean, versionId: ID): [StateConvergencePlan]
stateConvergencePlan(id: ID!): StateConvergencePlan
versions(manifestId: ID, deploymentGroupId: ID): [Version]
version(id: ID, manifestId: ID): Version
manifests(type: String, deploymentGroupId: ID): [Manifest]
manifest(id: ID!): Manifest
services(name: String, slug: String, parentId: ID, deploymentGroupId: ID, deploymentGroupSlug: String): [Service]
service(id: ID, hash: ID): Service
packages(name: String, type: String, memory: Int, disk: Int, swap: Int, lwps: Int, vcpus: Int, version: String, group: String): [Package]
package(id: ID!): Package
instances(name: String!, machineId: ID, status: InstanceStatus, serviceId: ID, serviceSlug: String, deploymentGroupId: ID, deploymentGroupSlug: String): [Instance]
instance(id: ID!): Instance
datacenter(id: ID, region: String): Datacenter
datacenters: [Datacenter]
}
type Mutation { provisionManifest(deploymentGroupId: ID!, type: ManifestType!, format: ManifestFormat!, raw: String!) : Manifest
createDeploymentGroup(name: String!) : DeploymentGroup scale(service: ID!, replicas: Int!) : Version
updateDeploymentGroup(id: ID!, name: String!) : DeploymentGroup
provisionManifest(deploymentGroupId: ID!, type: ManifestType!, format: ManifestFormat!, raw: String!) : Manifest stopServices(ids: [ID]!) : [Service]
scale(service: ID!, replicas: Int!) : Version startServices(ids: [ID]!) : [Service]
restartServices(ids: [ID]!) : [Service]
deleteServices(ids: [ID]!) : [Service]
stopServices(ids: [ID]!) : [Service] stopInstances(ids: [ID]!) : [Instance]
startServices(ids: [ID]!) : [Service] startInstances(ids: [ID]!) : [Instance]
restartServices(ids: [ID]!) : [Service] restartInstances(ids: [ID]!) : [Instance]
deleteServices(ids: [ID]!) : [Service]
stopInstances(ids: [ID]!) : [Instance] # reprovision() ???
startInstances(ids: [ID]!) : [Instance] }
restartInstances(ids: [ID]!) : [Instance]
# reprovision() ???
}