mirror of
https://github.com/yldio/copilot.git
synced 2024-11-15 07:40:07 +02:00
209 lines
4.8 KiB
GraphQL
209 lines
4.8 KiB
GraphQL
scalar Date
|
|
scalar Object
|
|
|
|
type Portal {
|
|
id: ID!
|
|
user: User!
|
|
datacenter: Datacenter!
|
|
deploymentGroups(name: String, slug: String): [DeploymentGroup]
|
|
}
|
|
|
|
type User {
|
|
id: ID!
|
|
firstName: String!
|
|
lastName: String!
|
|
email: String!
|
|
login: String!
|
|
}
|
|
|
|
enum DeploymentGroupStatus {
|
|
ACTIVE
|
|
PROVISIONING
|
|
DELETING
|
|
DELETED
|
|
UNKNOWN
|
|
}
|
|
|
|
type DeploymentGroup {
|
|
id: ID!
|
|
name: String!
|
|
slug: String!
|
|
services(name: String, slug: String, parentId: ID): [Service]
|
|
version: Version
|
|
history: [Version]
|
|
imported: Boolean
|
|
status: DeploymentGroupStatus
|
|
}
|
|
|
|
type ServiceScale {
|
|
serviceName: String!
|
|
replicas: Int!
|
|
}
|
|
|
|
enum ConvergenceActionType {
|
|
NOOP
|
|
CREATE
|
|
RECREATE
|
|
REMOVE
|
|
START
|
|
EXISTING # special status to mark existing ids in previous version
|
|
}
|
|
|
|
type ConvergenceAction {
|
|
type: ConvergenceActionType!
|
|
service: String! # service name
|
|
toProcess: Int, # merely used for book keeping
|
|
processed: [String], # merely used for book keeping
|
|
machines: [String]! # current instance machine ids
|
|
}
|
|
|
|
type Version {
|
|
manifest: Manifest!
|
|
scale(serviceName: String): [ServiceScale]!
|
|
plan: [ConvergenceAction]
|
|
hasPlan: Boolean
|
|
error: String
|
|
}
|
|
|
|
enum ManifestType {
|
|
COMPOSE
|
|
MARIPOSA
|
|
}
|
|
|
|
enum ManifestFormat {
|
|
JSON
|
|
YAML
|
|
}
|
|
|
|
type Manifest {
|
|
id: ID!
|
|
type: ManifestType!
|
|
format: ManifestFormat!
|
|
raw: String!
|
|
obj: Object
|
|
}
|
|
|
|
enum ServiceStatus {
|
|
ACTIVE # this doesn't mean that the instances are all running
|
|
PROVISIONING
|
|
SCALING
|
|
STOPPING
|
|
STOPPED
|
|
DELETING
|
|
DELETED
|
|
RESTARTING
|
|
UNKNOWN
|
|
}
|
|
|
|
# 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(name: String, machineId: ID, status: InstanceStatus): [Instance]!
|
|
connections: [String!] # list of serviceIds
|
|
parent: ID # parent service id
|
|
package: Package! # we don't have this in current mock data,
|
|
environment: [Environment]
|
|
image: String # used only for config
|
|
status: ServiceStatus
|
|
}
|
|
|
|
# for metrics max / min (I guess)
|
|
type Package {
|
|
id: ID!
|
|
name: String!
|
|
type: String!
|
|
memory: Float!
|
|
disk: Float!
|
|
swap: Float!
|
|
lwps: Int!
|
|
vcpus: Int!
|
|
version: String!
|
|
group: String!
|
|
}
|
|
|
|
# environment variables
|
|
type Environment {
|
|
name: String!
|
|
value: String!
|
|
}
|
|
|
|
enum InstanceStatus {
|
|
PROVISIONING
|
|
READY
|
|
ACTIVE # vm only: When used in ListVms, denotes machines that are not 'destroyed' or 'failed'
|
|
RUNNING
|
|
STOPPING
|
|
STOPPED
|
|
OFFLINE
|
|
DELETED
|
|
DESTROYED # vm only
|
|
FAILED
|
|
INCOMPLETE # vm only
|
|
UNKNOWN
|
|
}
|
|
|
|
type Instance {
|
|
id: ID!
|
|
name: String!
|
|
machineId: ID!
|
|
status: InstanceStatus!
|
|
healthy: Boolean
|
|
}
|
|
|
|
type Datacenter {
|
|
id: ID!
|
|
url: String!
|
|
name: String!
|
|
region: String!
|
|
}
|
|
|
|
# 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]
|
|
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
|
|
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]
|
|
|
|
config(deploymentGroupName: String!, type: ManifestType!, format: ManifestFormat!, raw: String!): [Service]
|
|
importableDeploymentGroups: [DeploymentGroup]
|
|
}
|
|
|
|
type Mutation {
|
|
createDeploymentGroup(name: String!): DeploymentGroup
|
|
updateDeploymentGroup(id: ID!, name: String!): DeploymentGroup
|
|
|
|
provisionManifest(deploymentGroupId: ID!, type: ManifestType!, format: ManifestFormat!, raw: String!): Version
|
|
scale(serviceId: ID!, replicas: Int!): Version
|
|
|
|
stopServices(ids: [ID]!): [Service]
|
|
startServices(ids: [ID]!): [Service]
|
|
restartServices(ids: [ID]!): [Service]
|
|
deleteServices(ids: [ID]!): [Service]
|
|
|
|
stopInstances(ids: [ID]!): [Instance]
|
|
startInstances(ids: [ID]!): [Instance]
|
|
restartInstances(ids: [ID]!): [Instance]
|
|
|
|
importDeploymentGroup(deploymentGroupSlug: String!): DeploymentGroup
|
|
}
|