From 3135f3b5a7509fb65933afb7ac7b6df17841d20b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Wed, 4 Oct 2017 18:27:26 +0100 Subject: [PATCH] feat(cloudapi-gql): add rebootMachine mutation --- packages/cloudapi-gql/src/schema/resolvers.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/cloudapi-gql/src/schema/resolvers.js b/packages/cloudapi-gql/src/schema/resolvers.js index e6c0462b..91ce41ad 100644 --- a/packages/cloudapi-gql/src/schema/resolvers.js +++ b/packages/cloudapi-gql/src/schema/resolvers.js @@ -136,6 +136,23 @@ const resolvers = { type: ({ type }) => (type ? type.toUpperCase() : type), // eslint-disable-next-line camelcase key_id: ({ keyId }) => keyId + }, + FirewallRule: { + machines: ({ id }) => api.firewall.listMachines({ id }) + }, + Snapshot: { + state: ({ state }) => (state ? state.toUpperCase() : state) + }, + ImageError: { + code: ({ code }) => (code ? code.toUpperCase() : code) + }, + ImageFile: { + compression: ({ compression }) => + compression ? compression.toUpperCase() : compression + }, + Mutation: { + rebootMachine: (root, { id }) => + api.machines.reboot(id).then(() => resolvers.Query.machine(null, { id })) } };