Modules¶
-
GET
/terraform/repositories
¶ Get the list of terraform repositories.
Response JSON Object: - repositories[key].url (string) – A URL fetchable with go-getter (https://github.com/hashicorp/go-getter)
Example response:
{ "repositories": { "cluster": { "url": "file:///C:/genvid/gv-version/bastion-services/terraform/modules/cluster" }, "game": { "url": "file:///C:/genvid/gv-version/bastion-services/terraform/modules/game" }, "genvid": { "url": "file:///C:/genvid/gv-version/bastion-services/terraform/modules/genvid" } } }
-
PUT
/terraform/repositories
¶ Update all the terraform repositories.
-
GET
/terraform/repository/{repositoryID}
¶ Get the body of a terraform repository
Parameters: - repositoryID – The name of a terraform repository. Must be a valid folder name and all lowercase.
Request JSON Object: - url (string) – A URL fetchable with go-getter (https://github.com/hashicorp/go-getter)
Response JSON Object: - repository.url (string) – A URL fetchable with go-getter (https://github.com/hashicorp/go-getter)
Example query:
{ "url": "" }
Example response:
{ "repository": { "url": "" } }
-
POST
/terraform/repository/{repositoryID}
¶ Set the URL for terraform repository and update it.
Parameters: - repositoryID – The name of a terraform repository. Must be a valid folder name and all lowercase.
Request JSON Object: - url (string) – A URL fetchable with go-getter (https://github.com/hashicorp/go-getter)
Response JSON Object: - repository.url (string) – A URL fetchable with go-getter (https://github.com/hashicorp/go-getter)
Example query:
{ "url": "" }
Example response:
{ "repository": { "url": "" } }
-
PUT
/terraform/repository/{repositoryID}
¶ If a body is given, update the definition of the repository. In all case, update the repository.
Parameters: - repositoryID – The name of a terraform repository. Must be a valid folder name and all lowercase.
Request JSON Object: - url (string) – A URL fetchable with go-getter (https://github.com/hashicorp/go-getter)
Response JSON Object: - repository.url (string) – A URL fetchable with go-getter (https://github.com/hashicorp/go-getter)
Example query:
{ "url": "" }
Example response:
{ "repository": { "url": "" } }
-
DELETE
/terraform/repository/{repositoryID}
¶ Remove a terraform repository
Parameters: - repositoryID – The name of a terraform repository. Must be a valid folder name and all lowercase.
Response JSON Object: - repository.url (string) – A URL fetchable with go-getter (https://github.com/hashicorp/go-getter)
Example response:
{ "repository": { "url": "" } }
-
GET
/terraform/modules
¶ Get the list of modules available. Only valid modules are return.
Response JSON Object: - modules[] (object) – A list of Terraform modules.
- modules[].repository (string) – The Terraform repository containing this module.
- modules[].path (string) – The relative path from the bastion root modules of this module.
- modules[].capabilities[] (string) – Array of capabilities
Example response:
{ "modules": [ { "repository": "cluster", "path": "cluster/default", "capabilities": [ "cluster-api" ] } ] }
-
GET
/terraform/modules/{prefix}
¶ Get the list of modules available under the prefix provide. Only valid modules are return.
Parameters: - prefix – The prefix to filter with. Only module inside this prefix are returns. Folder which partially match aren’t included.
Response JSON Object: - modules[] (object) – A list of Terraform modules.
- modules[].repository (string) – The Terraform repository containing this module.
- modules[].path (string) – The relative path from the bastion root modules of this module.
- modules[].capabilities[] (string) – Array of capabilities
Example response:
{ "modules": [ { "repository": "cluster", "path": "cluster/default", "capabilities": [ "cluster-api" ] } ] }
-
GET
/terraform/module/{module}
¶ Get the description of a Terraform module.
Parameters: - module – The relative path of a module.
Response JSON Object: - module.path (string) – The relative path from the bastion root modules of this module.
- module.variable[key].type (string) – The type of the variable.
- module.variable[key].description (string) – A description of the variable.
- module.variable[key].default – A default value for the variable.. Type can be any of string,array,object,null.
- module.output[key].value – The value of the output.. Type can be any of string,array,object,null.
- module.output[key].description (string) – A description of the output
- module.output[key].sensitive (boolean) – If the output value is sensitive
- module.output[key].depends_on[] (string) – Explicit dependencies of the output value.
Example response:
{ "module": { "path": "cluster/default", "variable": { "game_az": { "description": "AWS Availability Zone where the game instance is to be created.\n", "default": "a" }, "game_count": { "description": "Number of game instance to spawn", "default": 1 } }, "output": { "game_private_ips": { "value": "${module.game.private_ips}" }, "game_public_ips": { "value": "${module.game.public_ips}" } } } }
Terraform¶
-
GET
/terraform/instances
¶ Get the terraform instances
Response JSON Object: - [] (object) –
- [].instanceID (string) –
- [].modulePath (string) –
- [].destination (string) –
- [].bastionID (string) –
- [].clusterID (string) –
- [].serverIPs (string) –
Example response:
[ { "instanceID": "mycluster", "modulePath": "cluster/default", "destination": "C:\\Users\\myuser\\.genvid\\terraform\\workdir\\mycluster\\tf", "clusterID": "hd" } ]
-
GET
/terraform/instance/{instanceID}
¶ Get the terraform instances
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - instanceID (string) –
- modulePath (string) –
- destination (string) –
- bastionID (string) –
- clusterID (string) –
- serverIPs (string) –
Example response:
{ "instanceID": "mycluster", "modulePath": "cluster/default", "destination": "C:\\Users\\myuser\\.genvid\\terraform\\workdir\\mycluster\\tf", "clusterID": "hd" }
-
GET
/terraform/instance/{instanceID}/status
¶ Get the status of the instance.
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - status (string) –
The status of the cluster
- VOID: The cluster doesn’t exist.
- EMPTY: The cluster is not initialized.
- DOWN: The cluster has no resource instanciated.
- UP: The cluter has some resources instanciated.
- BUSY: The cluster is currently running a command.
- ERROR: An error occured during the retrieval of the status.
- INVALID: The current status is unknown or invalid.
Example response:
{ "status": "VOID" }
-
GET
/instance/{instanceID}/tfvars/default
¶ Get the default terraform variables.
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - [key] – . Type can be any of boolean,integer,number,object,string,null.
Example response:
{ "keyA": "valueA", "keyB": "valueB" }
-
GET
/terraform/instance/{instanceID}/tfvars
¶ Get the terraform variables. This is the content of the terraform.tfvars file.
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - [key] – . Type can be any of boolean,integer,number,object,string,null.
Example response:
{ "keyA": "valueA", "keyB": "valueB" }
-
POST
/terraform/instance/{instanceID}/tfvars
¶ Set the terraform variables. This is the content of the terraform.tfvars file.
Parameters: - instanceID – The instance ID. An opaque string.
Request JSON Object: - [key] – . Type can be any of boolean,integer,number,object,string,null.
Example query:
{ "keyA": "valueA", "keyB": "valueB" }
-
POST
/terraform/instance/{instanceID}/get
¶ Execute the terraform get command
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - data (string) –
Example response:
{ "data": "" }
-
POST
/terraform/instance/{instanceID}/importmodule
¶ Import a module to terraform
Parameters: - instanceID – The instance ID. An opaque string.
Query Parameters: - force – Force the operation even if the cluster is in error state.
Request JSON Object: - modulePath (string) – The module path
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example query:
{ "modulePath": "" }
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/init
¶ Execute the terraform init command
Parameters: - instanceID – The instance ID. An opaque string.
Query Parameters: - force – Force the operation even if the cluster is in error state.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/plan
¶ Execute the terraform plan command
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/refresh
¶ Execute the terraform refresh command
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/apply
¶ Execute the terraform apply command
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/apply/{planFileName}
¶ Execute the Terraform Apply command on the desired plan.
Parameters: - instanceID – The instance ID. An opaque string.
- planFileName – The plan file name.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/destroy
¶ Execute the terraform destroy command
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/output
¶ Execute the terraform output command
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - sensitive (boolean) –
- type (string) –
- value (undefined) –
Example response:
{ "sensitive": false, "type": "" }
-
GET
/instance/{instanceID}/content/{contentID}
¶ Get the content of a {contentID}.tf.json file
Parameters: - instanceID – The instance ID. An opaque string.
- contentID – The content ID. An opaque string.
Response JSON Object: - [key] – . Type can be any of boolean,integer,number,object,string,null.
Example response:
{ "keyA": "valueA", "keyB": "valueB" }
-
POST
/instance/{instanceID}/content/{contentID}
¶ Set the content of a {contentID}.tf.json file
Parameters: - instanceID – The instance ID. An opaque string.
- contentID – The content ID. An opaque string.
Request JSON Object: - [key] – . Type can be any of boolean,integer,number,object,string,null.
Example query:
{ "keyA": "valueA", "keyB": "valueB" }
-
DELETE
/instance/{instanceID}/content/{contentID}
¶ Delete a {contentID}.tf.json file
Parameters: - instanceID – The instance ID. An opaque string.
- contentID – The content ID. An opaque string.
Commands¶
-
GET
/terraform/instance/{instanceID}/commands
¶ Get the commands
Parameters: - instanceID – The instance ID. An opaque string.
Query Parameters: - current – If true, only return executing commands
Response JSON Object: - [] (object) –
- [].data (string) –
- [].instanceID (string) –
- [].category (string) –
- [].command (string) –
- [].args (string) –
- [].error (string) –
- [].start (string) –
- [].end (string) –
Example response:
[ { "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" } ]
-
GET
/terraform/instance/{instanceID}/command/{commandID}
¶ Get the command data
Parameters: - instanceID – The instance ID. An opaque string.
- commandID – The command ID. An opaque string.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
GET
/terraform/instance/{instanceID}/log/{commandID}
¶ Get a command log
Parameters: - instanceID – The instance ID. An opaque string.
- commandID – The command ID. An opaque string.
Query Parameters: - origin – Either start or end
- offset – The offset to the origin
- size – The max size of the return value
Response JSON Object: - offset (integer) –
- data (string) –
- isDone (boolean) –
Example response:
{ "data": "", "isDone": false }
-
GET
/instance/{instanceID}/terminate/{commandID}
¶ Terminate a command
Parameters: - instanceID – The instance ID. An opaque string.
- commandID – The command ID. An opaque string.
-
GET
/instance/{instanceID}/kill/{commandID}
¶ Kill a command
Parameters: - instanceID – The instance ID. An opaque string.
- commandID – The command ID. An opaque string.