From 750b53cd34693b92c98bec65fd8a7c63b46b1b70 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 27 Sep 2021 21:52:47 -0400 Subject: [PATCH 1/7] add categories --- util/package.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/package.go b/util/package.go index 417290941..52b5e80c8 100644 --- a/util/package.go +++ b/util/package.go @@ -91,6 +91,7 @@ type BasePolicyTemplate struct { Title string `config:"title" json:"title" validate:"required"` Description string `config:"description" json:"description" validate:"required"` Icons []Image `config:"icons,omitempty" json:"icons,omitempty" yaml:"icons,omitempty"` + Categories []string `config:"categories,omitempty" json:"categories,omitempty" yaml:"categories,omitempty"` } type PolicyTemplate struct { @@ -181,6 +182,7 @@ func NewPackage(basePath string) (*Package, error) { Name: t.Name, Title: t.Title, Description: t.Description, + Categories: t.Categories, } for k, i := range p.PolicyTemplates[i].Icons { From 3b775156e3163ccd3bf5f003b4bcab86a5d15307 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 27 Sep 2021 21:59:21 -0400 Subject: [PATCH 2/7] also add categories to top level --- .gitignore | 1 + util/package.go | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 517d5421e..1d7b1879a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ package-registry .idea +*.iml build diff --git a/util/package.go b/util/package.go index 52b5e80c8..cabfa53d9 100644 --- a/util/package.go +++ b/util/package.go @@ -83,6 +83,7 @@ type BasePackage struct { Icons []Image `config:"icons,omitempty" json:"icons,omitempty" yaml:"icons,omitempty"` Internal bool `config:"internal,omitempty" json:"internal,omitempty" yaml:"internal,omitempty"` BasePolicyTemplates []BasePolicyTemplate `json:"policy_templates,omitempty"` + Categories []string `config:"categories" json:"categories"` } // BasePolicyTemplate is used for the package policy templates in the /search endpoint From 57a48b54ba4886a0ce2a4a317a3e4d243d11c241 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 27 Sep 2021 22:17:36 -0400 Subject: [PATCH 3/7] does this work? --- util/package.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/util/package.go b/util/package.go index cabfa53d9..c8d0dcbd4 100644 --- a/util/package.go +++ b/util/package.go @@ -88,11 +88,11 @@ type BasePackage struct { // BasePolicyTemplate is used for the package policy templates in the /search endpoint type BasePolicyTemplate struct { - Name string `config:"name" json:"name" validate:"required"` - Title string `config:"title" json:"title" validate:"required"` - Description string `config:"description" json:"description" validate:"required"` - Icons []Image `config:"icons,omitempty" json:"icons,omitempty" yaml:"icons,omitempty"` - Categories []string `config:"categories,omitempty" json:"categories,omitempty" yaml:"categories,omitempty"` + Name string `config:"name" json:"name" validate:"required"` + Title string `config:"title" json:"title" validate:"required"` + Description string `config:"description" json:"description" validate:"required"` + Icons []Image `config:"icons,omitempty" json:"icons,omitempty" yaml:"icons,omitempty"` + Categories []string `config:"categories,omitempty" json:"categories,omitempty" yaml:"categories,omitempty"` } type PolicyTemplate struct { From d541ccb397ec29c13af8b8e9ccc8613ccb4e6404 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 28 Sep 2021 09:30:28 -0400 Subject: [PATCH 4/7] feedback --- CHANGELOG.md | 2 + testdata/generated/search-all.json | 95 +++++++++++++++++-- .../generated/search-category-custom.json | 59 ++++++++++-- .../generated/search-category-datastore.json | 9 +- .../generated/search-category-web-all.json | 25 ++++- testdata/generated/search-category-web.json | 12 +++ testdata/generated/search-kibana652.json | 36 ++++++- testdata/generated/search-kibana721.json | 74 +++++++++++++-- .../generated/search-package-example-all.json | 14 ++- .../generated/search-package-example.json | 9 +- .../search-package-experimental.json | 92 ++++++++++++++++-- .../generated/search-package-internal.json | 85 +++++++++++++++-- testdata/generated/search.json | 82 ++++++++++++++-- 13 files changed, 535 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22d09b9e9..628ff205b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +* Add categories to /search output. Categories are added to the package and policy-templates. [#722](https://github.com/elastic/package-registry/issues/722) + ### Deprecated ### Known Issues diff --git a/testdata/generated/search-all.json b/testdata/generated/search-all.json index c18c674af..3594d03ec 100644 --- a/testdata/generated/search-all.json +++ b/testdata/generated/search-all.json @@ -7,7 +7,10 @@ "description": "This package contains a datastream with the dataset_is_prefix flag set to true.\n", "type": "integration", "download": "/epr/dataset_is_prefix/dataset_is_prefix-0.0.1.zip", - "path": "/package/dataset_is_prefix/0.0.1" + "path": "/package/dataset_is_prefix/0.0.1", + "categories": [ + "custom" + ] }, { "name": "datasources", @@ -24,6 +27,9 @@ "title": "Datasource title", "description": "Details about the data source." } + ], + "categories": [ + "custom" ] }, { @@ -41,6 +47,10 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "containers", + "message_queue" ] }, { @@ -58,6 +68,9 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "monitoring" ] }, { @@ -68,7 +81,10 @@ "description": "Test package-specified Elasticsearch index privileges", "type": "solution", "download": "/epr/elasticsearch_privileges/elasticsearch_privileges-1.0.0.zip", - "path": "/package/elasticsearch_privileges/1.0.0" + "path": "/package/elasticsearch_privileges/1.0.0", + "categories": [ + "custom" + ] }, { "name": "example", @@ -78,7 +94,10 @@ "description": "This is the example integration.", "type": "integration", "download": "/epr/example/example-0.0.2.zip", - "path": "/package/example/0.0.2" + "path": "/package/example/0.0.2", + "categories": [ + "web" + ] }, { "name": "example", @@ -93,8 +112,15 @@ { "name": "logs", "title": "Logs datasource", - "description": "Datasource for your log files." + "description": "Datasource for your log files.", + "categories": [ + "datastore" + ] } + ], + "categories": [ + "crm", + "azure" ] }, { @@ -105,7 +131,10 @@ "description": "This is the foo integration", "type": "solution", "download": "/epr/foo/foo-1.0.0.zip", - "path": "/package/foo/1.0.0" + "path": "/package/foo/1.0.0", + "categories": [ + "custom" + ] }, { "name": "hidden", @@ -115,7 +144,10 @@ "description": "This is the hidden integration", "type": "solution", "download": "/epr/hidden/hidden-1.0.0.zip", - "path": "/package/hidden/1.0.0" + "path": "/package/hidden/1.0.0", + "categories": [ + "custom" + ] }, { "name": "ilmpolicy", @@ -125,7 +157,10 @@ "description": "Test form ILM Policy in Package", "type": "solution", "download": "/epr/ilmpolicy/ilmpolicy-1.0.0.zip", - "path": "/package/ilmpolicy/1.0.0" + "path": "/package/ilmpolicy/1.0.0", + "categories": [ + "custom" + ] }, { "name": "input_groups", @@ -158,8 +193,15 @@ "size": "32x32", "type": "image/svg+xml" } + ], + "categories": [ + "compute" ] } + ], + "categories": [ + "aws", + "cloud" ] }, { @@ -177,6 +219,9 @@ "title": "Input level templates", "description": "Input with input-level template to use input-level vars with" } + ], + "categories": [ + "custom" ] }, { @@ -194,6 +239,10 @@ "path": "/package/longdocs/1.0.4/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -211,6 +260,9 @@ "path": "/package/metricsonly/2.0.1/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom" ] }, { @@ -228,6 +280,9 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "custom" ] }, { @@ -245,6 +300,10 @@ "path": "/package/multiversion/1.0.3/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -262,6 +321,10 @@ "path": "/package/multiversion/1.0.4/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -279,6 +342,10 @@ "path": "/package/multiversion/1.1.0/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -289,7 +356,10 @@ "description": "This package does contain a dataset but not stream configs.\n", "type": "integration", "download": "/epr/no_stream_configs/no_stream_configs-1.0.0.zip", - "path": "/package/no_stream_configs/1.0.0" + "path": "/package/no_stream_configs/1.0.0", + "categories": [ + "custom" + ] }, { "name": "reference", @@ -314,6 +384,10 @@ "title": "Nginx logs and metrics.", "description": "Collecting logs and metrics from nginx." } + ], + "categories": [ + "custom", + "web" ] }, { @@ -324,6 +398,9 @@ "description": "This package contains a yaml pipeline.\n", "type": "integration", "download": "/epr/yamlpipeline/yamlpipeline-1.0.0.zip", - "path": "/package/yamlpipeline/1.0.0" + "path": "/package/yamlpipeline/1.0.0", + "categories": [ + "custom" + ] } ] \ No newline at end of file diff --git a/testdata/generated/search-category-custom.json b/testdata/generated/search-category-custom.json index 925c894ce..742bf8017 100644 --- a/testdata/generated/search-category-custom.json +++ b/testdata/generated/search-category-custom.json @@ -7,7 +7,10 @@ "description": "This package contains a datastream with the dataset_is_prefix flag set to true.\n", "type": "integration", "download": "/epr/dataset_is_prefix/dataset_is_prefix-0.0.1.zip", - "path": "/package/dataset_is_prefix/0.0.1" + "path": "/package/dataset_is_prefix/0.0.1", + "categories": [ + "custom" + ] }, { "name": "datasources", @@ -24,6 +27,9 @@ "title": "Datasource title", "description": "Details about the data source." } + ], + "categories": [ + "custom" ] }, { @@ -34,7 +40,10 @@ "description": "Test package-specified Elasticsearch index privileges", "type": "solution", "download": "/epr/elasticsearch_privileges/elasticsearch_privileges-1.0.0.zip", - "path": "/package/elasticsearch_privileges/1.0.0" + "path": "/package/elasticsearch_privileges/1.0.0", + "categories": [ + "custom" + ] }, { "name": "foo", @@ -44,7 +53,10 @@ "description": "This is the foo integration", "type": "solution", "download": "/epr/foo/foo-1.0.0.zip", - "path": "/package/foo/1.0.0" + "path": "/package/foo/1.0.0", + "categories": [ + "custom" + ] }, { "name": "hidden", @@ -54,7 +66,10 @@ "description": "This is the hidden integration", "type": "solution", "download": "/epr/hidden/hidden-1.0.0.zip", - "path": "/package/hidden/1.0.0" + "path": "/package/hidden/1.0.0", + "categories": [ + "custom" + ] }, { "name": "ilmpolicy", @@ -64,7 +79,10 @@ "description": "Test form ILM Policy in Package", "type": "solution", "download": "/epr/ilmpolicy/ilmpolicy-1.0.0.zip", - "path": "/package/ilmpolicy/1.0.0" + "path": "/package/ilmpolicy/1.0.0", + "categories": [ + "custom" + ] }, { "name": "input_level_templates", @@ -81,6 +99,9 @@ "title": "Input level templates", "description": "Input with input-level template to use input-level vars with" } + ], + "categories": [ + "custom" ] }, { @@ -98,6 +119,10 @@ "path": "/package/longdocs/1.0.4/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -115,6 +140,9 @@ "path": "/package/metricsonly/2.0.1/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom" ] }, { @@ -132,6 +160,9 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "custom" ] }, { @@ -149,6 +180,10 @@ "path": "/package/multiversion/1.1.0/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -159,7 +194,10 @@ "description": "This package does contain a dataset but not stream configs.\n", "type": "integration", "download": "/epr/no_stream_configs/no_stream_configs-1.0.0.zip", - "path": "/package/no_stream_configs/1.0.0" + "path": "/package/no_stream_configs/1.0.0", + "categories": [ + "custom" + ] }, { "name": "reference", @@ -184,6 +222,10 @@ "title": "Nginx logs and metrics.", "description": "Collecting logs and metrics from nginx." } + ], + "categories": [ + "custom", + "web" ] }, { @@ -194,6 +236,9 @@ "description": "This package contains a yaml pipeline.\n", "type": "integration", "download": "/epr/yamlpipeline/yamlpipeline-1.0.0.zip", - "path": "/package/yamlpipeline/1.0.0" + "path": "/package/yamlpipeline/1.0.0", + "categories": [ + "custom" + ] } ] \ No newline at end of file diff --git a/testdata/generated/search-category-datastore.json b/testdata/generated/search-category-datastore.json index 7adec6cc0..d820db325 100644 --- a/testdata/generated/search-category-datastore.json +++ b/testdata/generated/search-category-datastore.json @@ -12,8 +12,15 @@ { "name": "logs", "title": "Logs datasource", - "description": "Datasource for your log files." + "description": "Datasource for your log files.", + "categories": [ + "datastore" + ] } + ], + "categories": [ + "crm", + "azure" ] } ] \ No newline at end of file diff --git a/testdata/generated/search-category-web-all.json b/testdata/generated/search-category-web-all.json index 44e5c3204..a327ac37f 100644 --- a/testdata/generated/search-category-web-all.json +++ b/testdata/generated/search-category-web-all.json @@ -7,7 +7,10 @@ "description": "This is the example integration.", "type": "integration", "download": "/epr/example/example-0.0.2.zip", - "path": "/package/example/0.0.2" + "path": "/package/example/0.0.2", + "categories": [ + "web" + ] }, { "name": "longdocs", @@ -24,6 +27,10 @@ "path": "/package/longdocs/1.0.4/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -41,6 +48,10 @@ "path": "/package/multiversion/1.0.3/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -58,6 +69,10 @@ "path": "/package/multiversion/1.0.4/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -75,6 +90,10 @@ "path": "/package/multiversion/1.1.0/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -100,6 +119,10 @@ "title": "Nginx logs and metrics.", "description": "Collecting logs and metrics from nginx." } + ], + "categories": [ + "custom", + "web" ] } ] \ No newline at end of file diff --git a/testdata/generated/search-category-web.json b/testdata/generated/search-category-web.json index 3708b4e64..6161ea87a 100644 --- a/testdata/generated/search-category-web.json +++ b/testdata/generated/search-category-web.json @@ -14,6 +14,10 @@ "path": "/package/longdocs/1.0.4/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -31,6 +35,10 @@ "path": "/package/multiversion/1.1.0/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -56,6 +64,10 @@ "title": "Nginx logs and metrics.", "description": "Collecting logs and metrics from nginx." } + ], + "categories": [ + "custom", + "web" ] } ] \ No newline at end of file diff --git a/testdata/generated/search-kibana652.json b/testdata/generated/search-kibana652.json index 8ade94cf1..e4bdf42c8 100644 --- a/testdata/generated/search-kibana652.json +++ b/testdata/generated/search-kibana652.json @@ -7,7 +7,10 @@ "description": "This package contains a datastream with the dataset_is_prefix flag set to true.\n", "type": "integration", "download": "/epr/dataset_is_prefix/dataset_is_prefix-0.0.1.zip", - "path": "/package/dataset_is_prefix/0.0.1" + "path": "/package/dataset_is_prefix/0.0.1", + "categories": [ + "custom" + ] }, { "name": "datasources", @@ -24,6 +27,9 @@ "title": "Datasource title", "description": "Details about the data source." } + ], + "categories": [ + "custom" ] }, { @@ -41,6 +47,10 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "containers", + "message_queue" ] }, { @@ -58,6 +68,9 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "monitoring" ] }, { @@ -68,7 +81,10 @@ "description": "This is the example integration.", "type": "integration", "download": "/epr/example/example-0.0.2.zip", - "path": "/package/example/0.0.2" + "path": "/package/example/0.0.2", + "categories": [ + "web" + ] }, { "name": "metricsonly", @@ -85,6 +101,9 @@ "path": "/package/metricsonly/2.0.1/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom" ] }, { @@ -102,6 +121,9 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "custom" ] }, { @@ -112,7 +134,10 @@ "description": "This package does contain a dataset but not stream configs.\n", "type": "integration", "download": "/epr/no_stream_configs/no_stream_configs-1.0.0.zip", - "path": "/package/no_stream_configs/1.0.0" + "path": "/package/no_stream_configs/1.0.0", + "categories": [ + "custom" + ] }, { "name": "yamlpipeline", @@ -122,6 +147,9 @@ "description": "This package contains a yaml pipeline.\n", "type": "integration", "download": "/epr/yamlpipeline/yamlpipeline-1.0.0.zip", - "path": "/package/yamlpipeline/1.0.0" + "path": "/package/yamlpipeline/1.0.0", + "categories": [ + "custom" + ] } ] \ No newline at end of file diff --git a/testdata/generated/search-kibana721.json b/testdata/generated/search-kibana721.json index bb9523e88..6b7149c95 100644 --- a/testdata/generated/search-kibana721.json +++ b/testdata/generated/search-kibana721.json @@ -7,7 +7,10 @@ "description": "This package contains a datastream with the dataset_is_prefix flag set to true.\n", "type": "integration", "download": "/epr/dataset_is_prefix/dataset_is_prefix-0.0.1.zip", - "path": "/package/dataset_is_prefix/0.0.1" + "path": "/package/dataset_is_prefix/0.0.1", + "categories": [ + "custom" + ] }, { "name": "datasources", @@ -24,6 +27,9 @@ "title": "Datasource title", "description": "Details about the data source." } + ], + "categories": [ + "custom" ] }, { @@ -41,6 +47,10 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "containers", + "message_queue" ] }, { @@ -58,6 +68,9 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "monitoring" ] }, { @@ -73,8 +86,15 @@ { "name": "logs", "title": "Logs datasource", - "description": "Datasource for your log files." + "description": "Datasource for your log files.", + "categories": [ + "datastore" + ] } + ], + "categories": [ + "crm", + "azure" ] }, { @@ -85,7 +105,10 @@ "description": "This is the foo integration", "type": "solution", "download": "/epr/foo/foo-1.0.0.zip", - "path": "/package/foo/1.0.0" + "path": "/package/foo/1.0.0", + "categories": [ + "custom" + ] }, { "name": "hidden", @@ -95,7 +118,10 @@ "description": "This is the hidden integration", "type": "solution", "download": "/epr/hidden/hidden-1.0.0.zip", - "path": "/package/hidden/1.0.0" + "path": "/package/hidden/1.0.0", + "categories": [ + "custom" + ] }, { "name": "ilmpolicy", @@ -105,7 +131,10 @@ "description": "Test form ILM Policy in Package", "type": "solution", "download": "/epr/ilmpolicy/ilmpolicy-1.0.0.zip", - "path": "/package/ilmpolicy/1.0.0" + "path": "/package/ilmpolicy/1.0.0", + "categories": [ + "custom" + ] }, { "name": "input_groups", @@ -138,8 +167,15 @@ "size": "32x32", "type": "image/svg+xml" } + ], + "categories": [ + "compute" ] } + ], + "categories": [ + "aws", + "cloud" ] }, { @@ -157,6 +193,10 @@ "path": "/package/longdocs/1.0.4/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -174,6 +214,9 @@ "path": "/package/metricsonly/2.0.1/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom" ] }, { @@ -191,6 +234,9 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "custom" ] }, { @@ -208,6 +254,10 @@ "path": "/package/multiversion/1.1.0/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -218,7 +268,10 @@ "description": "This package does contain a dataset but not stream configs.\n", "type": "integration", "download": "/epr/no_stream_configs/no_stream_configs-1.0.0.zip", - "path": "/package/no_stream_configs/1.0.0" + "path": "/package/no_stream_configs/1.0.0", + "categories": [ + "custom" + ] }, { "name": "reference", @@ -243,6 +296,10 @@ "title": "Nginx logs and metrics.", "description": "Collecting logs and metrics from nginx." } + ], + "categories": [ + "custom", + "web" ] }, { @@ -253,6 +310,9 @@ "description": "This package contains a yaml pipeline.\n", "type": "integration", "download": "/epr/yamlpipeline/yamlpipeline-1.0.0.zip", - "path": "/package/yamlpipeline/1.0.0" + "path": "/package/yamlpipeline/1.0.0", + "categories": [ + "custom" + ] } ] \ No newline at end of file diff --git a/testdata/generated/search-package-example-all.json b/testdata/generated/search-package-example-all.json index 0e1dffec6..4e415570b 100644 --- a/testdata/generated/search-package-example-all.json +++ b/testdata/generated/search-package-example-all.json @@ -7,7 +7,10 @@ "description": "This is the example integration.", "type": "integration", "download": "/epr/example/example-0.0.2.zip", - "path": "/package/example/0.0.2" + "path": "/package/example/0.0.2", + "categories": [ + "web" + ] }, { "name": "example", @@ -22,8 +25,15 @@ { "name": "logs", "title": "Logs datasource", - "description": "Datasource for your log files." + "description": "Datasource for your log files.", + "categories": [ + "datastore" + ] } + ], + "categories": [ + "crm", + "azure" ] } ] \ No newline at end of file diff --git a/testdata/generated/search-package-example.json b/testdata/generated/search-package-example.json index 7adec6cc0..d820db325 100644 --- a/testdata/generated/search-package-example.json +++ b/testdata/generated/search-package-example.json @@ -12,8 +12,15 @@ { "name": "logs", "title": "Logs datasource", - "description": "Datasource for your log files." + "description": "Datasource for your log files.", + "categories": [ + "datastore" + ] } + ], + "categories": [ + "crm", + "azure" ] } ] \ No newline at end of file diff --git a/testdata/generated/search-package-experimental.json b/testdata/generated/search-package-experimental.json index 8e9cf0cc9..8caa59930 100644 --- a/testdata/generated/search-package-experimental.json +++ b/testdata/generated/search-package-experimental.json @@ -7,7 +7,10 @@ "description": "This package contains a datastream with the dataset_is_prefix flag set to true.\n", "type": "integration", "download": "/epr/dataset_is_prefix/dataset_is_prefix-0.0.1.zip", - "path": "/package/dataset_is_prefix/0.0.1" + "path": "/package/dataset_is_prefix/0.0.1", + "categories": [ + "custom" + ] }, { "name": "datasources", @@ -24,6 +27,9 @@ "title": "Datasource title", "description": "Details about the data source." } + ], + "categories": [ + "custom" ] }, { @@ -41,6 +47,10 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "containers", + "message_queue" ] }, { @@ -58,6 +68,9 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "monitoring" ] }, { @@ -68,7 +81,10 @@ "description": "Test package-specified Elasticsearch index privileges", "type": "solution", "download": "/epr/elasticsearch_privileges/elasticsearch_privileges-1.0.0.zip", - "path": "/package/elasticsearch_privileges/1.0.0" + "path": "/package/elasticsearch_privileges/1.0.0", + "categories": [ + "custom" + ] }, { "name": "example", @@ -83,8 +99,15 @@ { "name": "logs", "title": "Logs datasource", - "description": "Datasource for your log files." + "description": "Datasource for your log files.", + "categories": [ + "datastore" + ] } + ], + "categories": [ + "crm", + "azure" ] }, { @@ -95,7 +118,10 @@ "description": "Experimental package, should be set by default", "type": "solution", "download": "/epr/experimental/experimental-0.0.1.zip", - "path": "/package/experimental/0.0.1" + "path": "/package/experimental/0.0.1", + "categories": [ + "aws" + ] }, { "name": "fakeapm", @@ -105,7 +131,10 @@ "description": "Not actually APM", "type": "integration", "download": "/epr/fakeapm/fakeapm-1.0.0.zip", - "path": "/package/fakeapm/1.0.0" + "path": "/package/fakeapm/1.0.0", + "categories": [ + "monitoring" + ] }, { "name": "foo", @@ -115,7 +144,10 @@ "description": "This is the foo integration", "type": "solution", "download": "/epr/foo/foo-1.0.0.zip", - "path": "/package/foo/1.0.0" + "path": "/package/foo/1.0.0", + "categories": [ + "custom" + ] }, { "name": "hidden", @@ -125,7 +157,10 @@ "description": "This is the hidden integration", "type": "solution", "download": "/epr/hidden/hidden-1.0.0.zip", - "path": "/package/hidden/1.0.0" + "path": "/package/hidden/1.0.0", + "categories": [ + "custom" + ] }, { "name": "ilmpolicy", @@ -135,7 +170,10 @@ "description": "Test form ILM Policy in Package", "type": "solution", "download": "/epr/ilmpolicy/ilmpolicy-1.0.0.zip", - "path": "/package/ilmpolicy/1.0.0" + "path": "/package/ilmpolicy/1.0.0", + "categories": [ + "custom" + ] }, { "name": "input_groups", @@ -168,8 +206,15 @@ "size": "32x32", "type": "image/svg+xml" } + ], + "categories": [ + "compute" ] } + ], + "categories": [ + "aws", + "cloud" ] }, { @@ -187,6 +232,9 @@ "title": "Input level templates", "description": "Input with input-level template to use input-level vars with" } + ], + "categories": [ + "custom" ] }, { @@ -204,6 +252,10 @@ "path": "/package/longdocs/1.0.4/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -221,6 +273,9 @@ "path": "/package/metricsonly/2.0.1/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom" ] }, { @@ -238,6 +293,9 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "custom" ] }, { @@ -255,6 +313,10 @@ "path": "/package/multiversion/1.1.0/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -265,7 +327,10 @@ "description": "This package does contain a dataset but not stream configs.\n", "type": "integration", "download": "/epr/no_stream_configs/no_stream_configs-1.0.0.zip", - "path": "/package/no_stream_configs/1.0.0" + "path": "/package/no_stream_configs/1.0.0", + "categories": [ + "custom" + ] }, { "name": "reference", @@ -290,6 +355,10 @@ "title": "Nginx logs and metrics.", "description": "Collecting logs and metrics from nginx." } + ], + "categories": [ + "custom", + "web" ] }, { @@ -300,6 +369,9 @@ "description": "This package contains a yaml pipeline.\n", "type": "integration", "download": "/epr/yamlpipeline/yamlpipeline-1.0.0.zip", - "path": "/package/yamlpipeline/1.0.0" + "path": "/package/yamlpipeline/1.0.0", + "categories": [ + "custom" + ] } ] \ No newline at end of file diff --git a/testdata/generated/search-package-internal.json b/testdata/generated/search-package-internal.json index b99487bfb..a9846ffb7 100644 --- a/testdata/generated/search-package-internal.json +++ b/testdata/generated/search-package-internal.json @@ -7,7 +7,10 @@ "description": "This package contains a datastream with the dataset_is_prefix flag set to true.\n", "type": "integration", "download": "/epr/dataset_is_prefix/dataset_is_prefix-0.0.1.zip", - "path": "/package/dataset_is_prefix/0.0.1" + "path": "/package/dataset_is_prefix/0.0.1", + "categories": [ + "custom" + ] }, { "name": "datasources", @@ -24,6 +27,9 @@ "title": "Datasource title", "description": "Details about the data source." } + ], + "categories": [ + "custom" ] }, { @@ -41,6 +47,10 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "containers", + "message_queue" ] }, { @@ -58,6 +68,9 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "monitoring" ] }, { @@ -68,7 +81,10 @@ "description": "Test package-specified Elasticsearch index privileges", "type": "solution", "download": "/epr/elasticsearch_privileges/elasticsearch_privileges-1.0.0.zip", - "path": "/package/elasticsearch_privileges/1.0.0" + "path": "/package/elasticsearch_privileges/1.0.0", + "categories": [ + "custom" + ] }, { "name": "example", @@ -83,8 +99,15 @@ { "name": "logs", "title": "Logs datasource", - "description": "Datasource for your log files." + "description": "Datasource for your log files.", + "categories": [ + "datastore" + ] } + ], + "categories": [ + "crm", + "azure" ] }, { @@ -95,7 +118,10 @@ "description": "This is the foo integration", "type": "solution", "download": "/epr/foo/foo-1.0.0.zip", - "path": "/package/foo/1.0.0" + "path": "/package/foo/1.0.0", + "categories": [ + "custom" + ] }, { "name": "hidden", @@ -105,7 +131,10 @@ "description": "This is the hidden integration", "type": "solution", "download": "/epr/hidden/hidden-1.0.0.zip", - "path": "/package/hidden/1.0.0" + "path": "/package/hidden/1.0.0", + "categories": [ + "custom" + ] }, { "name": "ilmpolicy", @@ -115,7 +144,10 @@ "description": "Test form ILM Policy in Package", "type": "solution", "download": "/epr/ilmpolicy/ilmpolicy-1.0.0.zip", - "path": "/package/ilmpolicy/1.0.0" + "path": "/package/ilmpolicy/1.0.0", + "categories": [ + "custom" + ] }, { "name": "input_groups", @@ -148,8 +180,15 @@ "size": "32x32", "type": "image/svg+xml" } + ], + "categories": [ + "compute" ] } + ], + "categories": [ + "aws", + "cloud" ] }, { @@ -167,6 +206,9 @@ "title": "Input level templates", "description": "Input with input-level template to use input-level vars with" } + ], + "categories": [ + "custom" ] }, { @@ -178,7 +220,8 @@ "type": "integration", "download": "/epr/internal/internal-1.2.0.zip", "path": "/package/internal/1.2.0", - "internal": true + "internal": true, + "categories": [] }, { "name": "longdocs", @@ -195,6 +238,10 @@ "path": "/package/longdocs/1.0.4/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -212,6 +259,9 @@ "path": "/package/metricsonly/2.0.1/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom" ] }, { @@ -229,6 +279,9 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "custom" ] }, { @@ -246,6 +299,10 @@ "path": "/package/multiversion/1.1.0/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -256,7 +313,10 @@ "description": "This package does contain a dataset but not stream configs.\n", "type": "integration", "download": "/epr/no_stream_configs/no_stream_configs-1.0.0.zip", - "path": "/package/no_stream_configs/1.0.0" + "path": "/package/no_stream_configs/1.0.0", + "categories": [ + "custom" + ] }, { "name": "reference", @@ -281,6 +341,10 @@ "title": "Nginx logs and metrics.", "description": "Collecting logs and metrics from nginx." } + ], + "categories": [ + "custom", + "web" ] }, { @@ -291,6 +355,9 @@ "description": "This package contains a yaml pipeline.\n", "type": "integration", "download": "/epr/yamlpipeline/yamlpipeline-1.0.0.zip", - "path": "/package/yamlpipeline/1.0.0" + "path": "/package/yamlpipeline/1.0.0", + "categories": [ + "custom" + ] } ] \ No newline at end of file diff --git a/testdata/generated/search.json b/testdata/generated/search.json index 98c5dd8e2..0575e5120 100644 --- a/testdata/generated/search.json +++ b/testdata/generated/search.json @@ -7,7 +7,10 @@ "description": "This package contains a datastream with the dataset_is_prefix flag set to true.\n", "type": "integration", "download": "/epr/dataset_is_prefix/dataset_is_prefix-0.0.1.zip", - "path": "/package/dataset_is_prefix/0.0.1" + "path": "/package/dataset_is_prefix/0.0.1", + "categories": [ + "custom" + ] }, { "name": "datasources", @@ -24,6 +27,9 @@ "title": "Datasource title", "description": "Details about the data source." } + ], + "categories": [ + "custom" ] }, { @@ -41,6 +47,10 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "containers", + "message_queue" ] }, { @@ -58,6 +68,9 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "monitoring" ] }, { @@ -68,7 +81,10 @@ "description": "Test package-specified Elasticsearch index privileges", "type": "solution", "download": "/epr/elasticsearch_privileges/elasticsearch_privileges-1.0.0.zip", - "path": "/package/elasticsearch_privileges/1.0.0" + "path": "/package/elasticsearch_privileges/1.0.0", + "categories": [ + "custom" + ] }, { "name": "example", @@ -83,8 +99,15 @@ { "name": "logs", "title": "Logs datasource", - "description": "Datasource for your log files." + "description": "Datasource for your log files.", + "categories": [ + "datastore" + ] } + ], + "categories": [ + "crm", + "azure" ] }, { @@ -95,7 +118,10 @@ "description": "This is the foo integration", "type": "solution", "download": "/epr/foo/foo-1.0.0.zip", - "path": "/package/foo/1.0.0" + "path": "/package/foo/1.0.0", + "categories": [ + "custom" + ] }, { "name": "hidden", @@ -105,7 +131,10 @@ "description": "This is the hidden integration", "type": "solution", "download": "/epr/hidden/hidden-1.0.0.zip", - "path": "/package/hidden/1.0.0" + "path": "/package/hidden/1.0.0", + "categories": [ + "custom" + ] }, { "name": "ilmpolicy", @@ -115,7 +144,10 @@ "description": "Test form ILM Policy in Package", "type": "solution", "download": "/epr/ilmpolicy/ilmpolicy-1.0.0.zip", - "path": "/package/ilmpolicy/1.0.0" + "path": "/package/ilmpolicy/1.0.0", + "categories": [ + "custom" + ] }, { "name": "input_groups", @@ -148,8 +180,15 @@ "size": "32x32", "type": "image/svg+xml" } + ], + "categories": [ + "compute" ] } + ], + "categories": [ + "aws", + "cloud" ] }, { @@ -167,6 +206,9 @@ "title": "Input level templates", "description": "Input with input-level template to use input-level vars with" } + ], + "categories": [ + "custom" ] }, { @@ -184,6 +226,10 @@ "path": "/package/longdocs/1.0.4/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -201,6 +247,9 @@ "path": "/package/metricsonly/2.0.1/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom" ] }, { @@ -218,6 +267,9 @@ "title": "Logs datasource", "description": "Datasource for your log files." } + ], + "categories": [ + "custom" ] }, { @@ -235,6 +287,10 @@ "path": "/package/multiversion/1.1.0/img/icon.svg", "type": "image/svg+xml" } + ], + "categories": [ + "custom", + "web" ] }, { @@ -245,7 +301,10 @@ "description": "This package does contain a dataset but not stream configs.\n", "type": "integration", "download": "/epr/no_stream_configs/no_stream_configs-1.0.0.zip", - "path": "/package/no_stream_configs/1.0.0" + "path": "/package/no_stream_configs/1.0.0", + "categories": [ + "custom" + ] }, { "name": "reference", @@ -270,6 +329,10 @@ "title": "Nginx logs and metrics.", "description": "Collecting logs and metrics from nginx." } + ], + "categories": [ + "custom", + "web" ] }, { @@ -280,6 +343,9 @@ "description": "This package contains a yaml pipeline.\n", "type": "integration", "download": "/epr/yamlpipeline/yamlpipeline-1.0.0.zip", - "path": "/package/yamlpipeline/1.0.0" + "path": "/package/yamlpipeline/1.0.0", + "categories": [ + "custom" + ] } ] \ No newline at end of file From 08e570993aa624588930ae33289612164b2fcb6d Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 28 Sep 2021 09:38:32 -0400 Subject: [PATCH 5/7] more feedback --- util/package.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/util/package.go b/util/package.go index c8d0dcbd4..0fa1537bc 100644 --- a/util/package.go +++ b/util/package.go @@ -83,16 +83,16 @@ type BasePackage struct { Icons []Image `config:"icons,omitempty" json:"icons,omitempty" yaml:"icons,omitempty"` Internal bool `config:"internal,omitempty" json:"internal,omitempty" yaml:"internal,omitempty"` BasePolicyTemplates []BasePolicyTemplate `json:"policy_templates,omitempty"` - Categories []string `config:"categories" json:"categories"` + Categories []string `config:"categories,omitempty" json:"categories,omitempty" yaml:"categories,omitempty"` } // BasePolicyTemplate is used for the package policy templates in the /search endpoint type BasePolicyTemplate struct { - Name string `config:"name" json:"name" validate:"required"` - Title string `config:"title" json:"title" validate:"required"` - Description string `config:"description" json:"description" validate:"required"` - Icons []Image `config:"icons,omitempty" json:"icons,omitempty" yaml:"icons,omitempty"` - Categories []string `config:"categories,omitempty" json:"categories,omitempty" yaml:"categories,omitempty"` + Name string `config:"name" json:"name" validate:"required"` + Title string `config:"title" json:"title" validate:"required"` + Description string `config:"description" json:"description" validate:"required"` + Icons []Image `config:"icons,omitempty" json:"icons,omitempty" yaml:"icons,omitempty"` + Categories []string `config:"categories,omitempty" json:"categories,omitempty" yaml:"categories,omitempty"` } type PolicyTemplate struct { From 7443ceb6e43abf2fb99d49f1c862a17a4a1b99fb Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 28 Sep 2021 09:46:55 -0400 Subject: [PATCH 6/7] regenerate due to annotation change --- testdata/generated/search-package-internal.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testdata/generated/search-package-internal.json b/testdata/generated/search-package-internal.json index a9846ffb7..8e2944b9c 100644 --- a/testdata/generated/search-package-internal.json +++ b/testdata/generated/search-package-internal.json @@ -220,8 +220,7 @@ "type": "integration", "download": "/epr/internal/internal-1.2.0.zip", "path": "/package/internal/1.2.0", - "internal": true, - "categories": [] + "internal": true }, { "name": "longdocs", From d2bbfb6efbca8c93d0c9195c871d40450817fae0 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Tue, 28 Sep 2021 15:05:02 -0400 Subject: [PATCH 7/7] fix changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 628ff205b..b3ac46138 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -* Add categories to /search output. Categories are added to the package and policy-templates. [#722](https://github.com/elastic/package-registry/issues/722) +* Add categories to /search output. Categories are added to the package and policy-templates. [#735](https://github.com/elastic/package-registry/pull/735) ### Deprecated