Basic support for variables block
This commit is contained in:
@@ -143,10 +143,12 @@ public class BoshDeploymentManifestSchema implements YamlSchema {
|
||||
addProp(t_instance_group, "env", t_instance_group_env);
|
||||
|
||||
addProp(TOPLEVEL_TYPE, "instance_groups", f.yseq(t_instance_group)).isRequired(true);
|
||||
|
||||
addProp(TOPLEVEL_TYPE, "properties", t_params).isDeprecated("Deprecated in favor of job level properties and links");
|
||||
|
||||
YType t_variable = t_params; //TODO: https://www.pivotaltracker.com/story/show/148627441
|
||||
YBeanType t_variable = f.ybean("Variable");
|
||||
addProp(t_variable, "name", t_ne_string).isPrimary(true);
|
||||
addProp(t_variable, "type", f.yenum("VariableType", "certificate", "password", "rsa", "ssh")).isRequired(true);
|
||||
addProp(t_variable, "options", t_params);
|
||||
addProp(TOPLEVEL_TYPE, "variables", f.yseq(t_variable));
|
||||
|
||||
addProp(TOPLEVEL_TYPE, "tags", t_params);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
*Required*. Unique name used to identify a variable. Example: `admin_password`
|
||||
@@ -0,0 +1 @@
|
||||
*Optional*. Specifies generation options used for generating variable value if variable is not found. Example: `{is_ca: true, common_name: some-ca}`
|
||||
@@ -0,0 +1 @@
|
||||
*Required*. Type of a variable. Currently supported variable types are `certificate`, `password`, `rsa`, and `ssh`. Example: `password`.
|
||||
@@ -147,7 +147,8 @@ public class BoshEditorTest {
|
||||
"update:\n <*>"
|
||||
, // ============
|
||||
"name: blah\n" +
|
||||
"variables:\n- <*>"
|
||||
"variables:\n" +
|
||||
"- name: <*>"
|
||||
, // ============
|
||||
"name: blah\n" +
|
||||
"director_uuid: <*>"
|
||||
@@ -461,4 +462,59 @@ public class BoshEditorTest {
|
||||
editor.assertHoverContains("serial", "deployed in parallel");
|
||||
}
|
||||
|
||||
@Test public void variablesBlockCompletions() throws Exception {
|
||||
Editor editor = harness.newEditor(
|
||||
"variables:\n" +
|
||||
"- <*>"
|
||||
);
|
||||
editor.assertCompletions(
|
||||
"variables:\n" +
|
||||
"- name: <*>"
|
||||
);
|
||||
|
||||
editor = harness.newEditor(
|
||||
"variables:\n" +
|
||||
"- name: foo\n" +
|
||||
" <*>"
|
||||
);
|
||||
editor.assertCompletions(PLAIN_COMPLETION,
|
||||
"variables:\n" +
|
||||
"- name: foo\n" +
|
||||
" options:\n" +
|
||||
" <*>"
|
||||
, // ===============
|
||||
"variables:\n" +
|
||||
"- name: foo\n" +
|
||||
" type: <*>"
|
||||
);
|
||||
|
||||
editor = harness.newEditor(
|
||||
"variables:\n" +
|
||||
"- name: foo\n" +
|
||||
" type: <*>"
|
||||
);
|
||||
editor.assertCompletionLabels("certificate", "password", "rsa", "ssh");
|
||||
}
|
||||
|
||||
@Test public void variablesBlockHovers() throws Exception {
|
||||
Editor editor = harness.newEditor(
|
||||
"variables:\n" +
|
||||
"- name: admin_password\n" +
|
||||
" type: password\n" +
|
||||
"- name: default_ca\n" +
|
||||
" type: certificate\n" +
|
||||
" options:\n" +
|
||||
" is_ca: true\n" +
|
||||
" common_name: some-ca\n" +
|
||||
"- name: director_ssl\n" +
|
||||
" type: certificate\n" +
|
||||
" options:\n" +
|
||||
" ca: default_ca\n" +
|
||||
" common_name: cc.cf.internal\n" +
|
||||
" alternative_names: [cc.cf.internal]"
|
||||
);
|
||||
editor.assertHoverContains("name", "Unique name used to identify a variable");
|
||||
editor.assertHoverContains("type", "Type of a variable");
|
||||
editor.assertHoverContains("options", "Specifies generation options");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user