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