From 203f740de6a6aa25d79c575a1f9ad5cb904c25c8 Mon Sep 17 00:00:00 2001 From: subash Date: Wed, 5 Jul 2023 20:51:30 +1000 Subject: [PATCH] add json schema --- README.md | 1 + example/custom-prefix.yml | 1 + example/safebox.yml | 5 ++-- example/secretsmanager.yml | 1 + schema.json | 58 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 schema.json diff --git a/README.md b/README.md index 2f535a4..01b4ee8 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ To install it directly find the right version for your machine in [releases](htt 1. Create a configuration file called `safebox.yml`. ```yaml +# yaml-language-server: $schema=https://raw.githubusercontent.com/monebag/safebox/main/schema.json service: my-service provider: ssm diff --git a/example/custom-prefix.yml b/example/custom-prefix.yml index 059033e..f511885 100644 --- a/example/custom-prefix.yml +++ b/example/custom-prefix.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=../schema.json service: safebox provider: ssm diff --git a/example/safebox.yml b/example/safebox.yml index 65c2020..8b1bb14 100644 --- a/example/safebox.yml +++ b/example/safebox.yml @@ -1,10 +1,11 @@ +# yaml-language-server: $schema=../schema.json service: safebox provider: ssm - + cloudformation-stacks: - "{{.stage}}-shared-infra-SharedInfraServerless" - "{{.stage}}-user-debug-stack" - + config: defaults: DB_NAME: "database name updated" diff --git a/example/secretsmanager.yml b/example/secretsmanager.yml index 45c9caa..66459c1 100644 --- a/example/secretsmanager.yml +++ b/example/secretsmanager.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=../schema.json service: safebox provider: secrets-manager diff --git a/schema.json b/schema.json new file mode 100644 index 0000000..348903c --- /dev/null +++ b/schema.json @@ -0,0 +1,58 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "additionalProperties": false, + "description": "Configuration for safebox to deploy parameters to various parameter stores", + "properties": { + "service": { + "type": "string", + "description": "Name of the service. parameters will be prefixed by the value provided" + }, + "provider": { + "type": "string", + "enum": ["ssm", "secrets-manager"], + "description": "Deploy parameters to the given provider. Eg. ssm, secrets-manager" + }, + "prefix": { + "type": "string", + "description": "Prefix to apply to all parameters. Does not apply for shared", + "default": "///" + }, + "cloudformation-stacks": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Cloudformation stack names. Any output values from the stacks can be interpolated. Eg. DB_NAME: \"{{.myDbName}}\"\nmyDbName is the output of one of the cloudformation stacks" + }, + "config": { + "type": "object", + "description": "Parameters to deploy as non secret. You can also specify stage specific key value pairs. Same key in the defaults will be ignored and stage specific value will be used.", + "properties": { + "defaults": { + "type": "object", + "description": "parameter name and value. Output is ///" + }, + "shared": { + "type": "object", + "description": "Params that are to be shared between multiple services. The parameter name wont be prefixed by service name. Output is //shared/" + } + } + }, + "secret": { + "type": "object", + "description": "Parameters to deploy as secret. You cannot specify stage specific key value pairs. Value is the description. You will need to run safebox deploy in prompt mode to provide the actual value.", + "properties": { + "defaults": { + "type": "object", + "description": "parameter name and value. Output is ///" + }, + "shared": { + "type": "object", + "description": "Params that are to be shared between multiple services. The parameter name wont be prefixed by service name. Output is //shared/" + } + } + } + }, + "required": ["service", "provider"], + "type": "object" +}