From 157b121ffa4366de0e759cdf4408980c4e576069 Mon Sep 17 00:00:00 2001 From: Kris De Volder Date: Tue, 8 Aug 2017 11:07:45 -0700 Subject: [PATCH] CloudConfig toplevel property hovers --- .../vscode/bosh/BoshCloudConfigSchema.java | 12 +++++----- .../ide/vscode/bosh/SchemaSupport.java | 4 ++-- .../resources/cloud-config/CloudConfig/azs.md | 23 +++++++++++++++++++ .../cloud-config/CloudConfig/compilation.md | 10 ++++++++ .../cloud-config/CloudConfig/disk_types.md | 19 +++++++++++++++ .../cloud-config/CloudConfig/networks.md | 13 +++++++++++ .../cloud-config/CloudConfig/vm_types.md | 18 +++++++++++++++ .../ide/vscode/bosh/BoshEditorTest.java | 15 ++++++++++++ 8 files changed, 106 insertions(+), 8 deletions(-) create mode 100644 headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/azs.md create mode 100644 headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/compilation.md create mode 100644 headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/disk_types.md create mode 100644 headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/networks.md create mode 100644 headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/vm_types.md diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshCloudConfigSchema.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshCloudConfigSchema.java index c643e004a..33339b823 100644 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshCloudConfigSchema.java +++ b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshCloudConfigSchema.java @@ -27,12 +27,12 @@ public class BoshCloudConfigSchema extends SchemaSupport implements YamlSchema { t_any = f.yany("Object"); this.toplevelType = f.ybean("CloudConfig"); - addProp(toplevelType, "azs", t_any); - addProp(toplevelType, "networks", t_any); - addProp(toplevelType, "vm_types", t_any); + addProp(toplevelType, "azs", t_any).isRequired(true); + addProp(toplevelType, "networks", t_any).isRequired(true); + addProp(toplevelType, "vm_types", t_any).isRequired(true); addProp(toplevelType, "vm_extensions", t_any); - addProp(toplevelType, "disk_types", t_any); - addProp(toplevelType, "compilation", t_any); + addProp(toplevelType, "disk_types", t_any).isRequired(true); + addProp(toplevelType, "compilation", t_any).isRequired(true); } @Override @@ -47,6 +47,6 @@ public class BoshCloudConfigSchema extends SchemaSupport implements YamlSchema { @Override protected String getResourcePathPrefix() { - return "cloud-config"; + return "/cloud-config/"; } } diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/SchemaSupport.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/SchemaSupport.java index 34f409840..6d407e8a0 100644 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/SchemaSupport.java +++ b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/SchemaSupport.java @@ -31,7 +31,7 @@ public class SchemaSupport { } protected String getResourcePathPrefix() { - return "desc"; + return "/desc/"; } protected YTypedPropertyImpl prop(AbstractType beanType, String name, YType type) { @@ -42,7 +42,7 @@ public class SchemaSupport { protected Renderable descriptionFor(YType owner, String propName) { String typeName = owner.toString(); - return Renderables.fromClasspath(BoshDeploymentManifestSchema.class, getResourcePathPrefix()+typeName+"/"+propName); + return Renderables.fromClasspath(SchemaSupport.class, getResourcePathPrefix()+typeName+"/"+propName); } protected YTypedPropertyImpl addProp(AbstractType bean, String name, YType type) { diff --git a/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/azs.md b/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/azs.md new file mode 100644 index 000000000..27f7e14d2 --- /dev/null +++ b/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/azs.md @@ -0,0 +1,23 @@ +*Required*. Specifies the AZs available to deployments. At least one should be specified. + +See [first class AZs](https://bosh.io/docs/azs.html) for more details. + +Example: + + azs: + - name: z1 + cloud_properties: + availability_zone: us-east-1c + - name: z2 + cloud_properties: + availability_zone: us-east-1d + +CPI Specific `cloud_properties`. + +- See [AWS CPI AZ cloud properties](https://bosh.io/docs/aws-cpi.html#azs). +- See [Azure CPI AZ cloud properties](https://bosh.io/docs/azure-cpi.html#azs"). +- See [OpenStack CPI AZ cloud properties](https://bosh.io/docks/openstack-cpi.html#azs). +- See [Softlayer CPI AZ cloud properties](https://bosh.io/docks/softlayer-cpi.html#azs). +- See [Google Cloud Platform CPI AZ cloud properties](https://bosh.io/docks/google-cpi.html#azs). +- See [vSphere CPI AZ cloud properties](https://bosh.io/docks/vsphere-cpi.html#azs). +- See [See vCloud CPI AZ cloud properties](https://bosh.io/docks/vcloud-cpi.html#azs). \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/compilation.md b/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/compilation.md new file mode 100644 index 000000000..7f76200e8 --- /dev/null +++ b/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/compilation.md @@ -0,0 +1,10 @@ +*Require*. The Director creates compilation VMs for release compilation. The Director will compile each release on every necessary stemcell used in a deployment. A compilation definition allows to specify VM characteristics. + +Example: + + compilation: + workers: 2 + reuse_compilation_vms: true + az: z1 + vm_type: default + network: private diff --git a/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/disk_types.md b/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/disk_types.md new file mode 100644 index 000000000..38a3b3364 --- /dev/null +++ b/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/disk_types.md @@ -0,0 +1,19 @@ +*Required*. Specifies the [disk types](https://bosh.io/docs/terminology.html#disk-types) available to deployments. At least one should be specified. + +Example: + + disk_types: + - name: default + disk_size: 2 + cloud_properties: + type: gp2 + +CPI Specific `cloud_properties` + +- See [AWS CPI disk type cloud properties](https://bosh.io/docs/aws-cpi.html#disk-pools) +- See [Azure CPI disk type cloud properties](https://bosh.io/docs/azure-cpi.html#disk-pools) +- See [OpenStack CPI disk type cloud properties](https://bosh.io/docs/openstack-cpi.html#disk-pools) +- See [Softlayer CPI disk type cloud properties](https://bosh.io/docs/softlayer-cpi.html#disk-pools) +- See [Google Cloud Platform CPI disk type cloud properties](https://bosh.io/docs/google-cpi.html#disk-pools) +- See [vSphere CPI disk type cloud properties](https://bosh.io/docs/vsphere-cpi.html#disk-pools) +- See [vCloud CPI disk type cloud properties](https://bosh.io/docs/vcloud-cpi.html#disk-pools) diff --git a/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/networks.md b/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/networks.md new file mode 100644 index 000000000..cffe9ef36 --- /dev/null +++ b/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/networks.md @@ -0,0 +1,13 @@ +*required*. Each sub-block listed in the Networks block specifies a network configuration that jobs can reference. There are three different network types: `manual`, `dynamic`, and `vip`. At least one should be specified. + +See [networks](https://bosh.io/docs/networks.html) for more details. + +CPI Specific `cloud_properties` + +- See [AWS CPI network cloud properties](https://bosh.io/docs/aws-cpi.html#networks) +- See [Azure CPI network cloud properties](https://bosh.io/docs/azure-cpi.html#networks) +- See [OpenStack CPI network cloud properties](https://bosh.io/docs/openstack-cpi.html#networks) +- See [Softlayer CPI network cloud properties](https://bosh.io/docs/softlayer-cpi.html#networks) +- See [Google Cloud Plaform CPI network cloud properties](https://bosh.io/docs/google-cpi.html#networks) +- See [vSphere CPI network cloud properties](https://bosh.io/docs/vsphere-cpi.html#networks) +- See [vCloud CPI network cloud properties](https://bosh.io/docs/vcloud-cpi.html#networks) diff --git a/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/vm_types.md b/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/vm_types.md new file mode 100644 index 000000000..bfca544c6 --- /dev/null +++ b/headless-services/bosh-language-server/src/main/resources/cloud-config/CloudConfig/vm_types.md @@ -0,0 +1,18 @@ +*Required*. Specifies the [VM types](https://bosh.io/docs/terminology.html#vm-type) available to deployments. At least one should be specified. + +Example: + + vm_types: + - name: default + cloud_properties: + instance_type: m1.small + +CPI Specific `cloud_properties` + +- See [AWS CPI VM types cloud properties](https://bosh.io/docs/aws-cpi.html#resource-pools) +- See [Azure CPI VM types cloud properties](https://bosh.io/docs/azure-cpi.html#resource-pools) +- See [OpenStack CPI VM types cloud properties](https://bosh.io/docs/openstack-cpi.html#resource-pools) +- See [Softlayer CPI VM types cloud properties](https://bosh.io/docs/softlayer-cpi.html#resource-pools) +- See [Google Cloud Platform CPI VM types cloud properties](https://bosh.io/docs/google-cpi.html#resource-pools) +- See [vSphere CPI VM types cloud properties](https://bosh.io/docs/vsphere-cpi.html#resource-pools) +- See [vCloud CPI VM types cloud properties](https://bosh.io/docs/vcloud-cpi.html#resource-pools) diff --git a/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/bosh/BoshEditorTest.java b/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/bosh/BoshEditorTest.java index 3bbdd0bcf..7eeb1cf42 100644 --- a/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/bosh/BoshEditorTest.java +++ b/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/bosh/BoshEditorTest.java @@ -1895,4 +1895,19 @@ public class BoshEditorTest { editor.assertProblems("bogus|Unknown property"); } + @Test public void cloudconfig_toplevel_hovers() throws Exception { + Editor editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, + "azs: []\n" + + "vm_types: []\n" + + "disk_types: []\n" + + "networks: []\n" + + "compilation: {}\n" + ); + editor.assertHoverContains("azs", "Specifies the AZs available to deployments."); + editor.assertHoverContains("networks", "specifies a network configuration that jobs can reference."); + editor.assertHoverContains("vm_types", "Specifies the [VM types](https://bosh.io/docs/terminology.html#vm-type) available to deployments."); + editor.assertHoverContains("disk_types", "Specifies the [disk types](https://bosh.io/docs/terminology.html#disk-types) available to deployments."); + editor.assertHoverContains("compilation", "A compilation definition allows to specify VM characteristics."); + } + }