Skip to content

Commit

Permalink
Add package type to manifest file (#95)
Browse files Browse the repository at this point in the history
Currently the type is not used and the default type is 'integration'. But this gives us the option in the future to also introduce packages which are not integrations, for example for solutions.
  • Loading branch information
ruflin committed Sep 10, 2019
1 parent 898abe2 commit 0c7e8c5
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ASSETS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ version: 0.0.2
categories: ["logs", "metrics"]
# Options are experimental, beta, ga
release: beta
# The package type. The options for now are [integration, solution], more type might be added in the future.
# The default type is integration and will be set if empty.
type: integration
compatibility: [1.0.2, 2.0.1]
os.platform: [darwin, freebsd, linux, macos, openbsd, windows]
Expand Down
1 change: 1 addition & 0 deletions dev/package-examples/coredns-1.0.1/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ version: 1.0.1
categories: ["logs", "metrics"]
release: beta
license: basic
type: integration

requirement:
kibana:
Expand Down
1 change: 1 addition & 0 deletions dev/package-examples/multiversion-1.0.4/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version: 1.0.4
categories: ["logs", "metrics"]
release: ga
license: basic
type: integration

requirement:
kibana:
Expand Down
1 change: 1 addition & 0 deletions docs/api/search-category-logs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"download": "/package/example-1.0.0.tar.gz",
"name": "example",
"title": "Example Integration",
"type": "integration",
"version": "1.0.0"
}
]
2 changes: 2 additions & 0 deletions docs/api/search-category-metrics.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
"download": "/package/example-1.0.0.tar.gz",
"name": "example",
"title": "Example Integration",
"type": "integration",
"version": "1.0.0"
},
{
"description": "This is the foo integration",
"download": "/package/foo-1.0.0.tar.gz",
"name": "foo",
"title": "Foo",
"type": "solution",
"version": "1.0.0"
}
]
1 change: 1 addition & 0 deletions docs/api/search-kibana652.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "This is the example integration.",
"download": "/package/example-0.0.5.tar.gz",
"name": "example",
"type": "integration",
"version": "0.0.5"
}
]
2 changes: 2 additions & 0 deletions docs/api/search-kibana721.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
"download": "/package/example-1.0.0.tar.gz",
"name": "example",
"title": "Example Integration",
"type": "integration",
"version": "1.0.0"
},
{
"description": "This is the foo integration",
"download": "/package/foo-1.0.0.tar.gz",
"name": "foo",
"title": "Foo",
"type": "solution",
"version": "1.0.0"
}
]
2 changes: 2 additions & 0 deletions docs/api/search-package-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
"description": "This is the example integration.",
"download": "/package/example-0.0.5.tar.gz",
"name": "example",
"type": "integration",
"version": "0.0.5"
},
{
"description": "This is the example integration",
"download": "/package/example-1.0.0.tar.gz",
"name": "example",
"title": "Example Integration",
"type": "integration",
"version": "1.0.0"
}
]
2 changes: 2 additions & 0 deletions docs/api/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
"download": "/package/example-1.0.0.tar.gz",
"name": "example",
"title": "Example Integration",
"type": "integration",
"version": "1.0.0"
},
{
"description": "This is the foo integration",
"download": "/package/foo-1.0.0.tar.gz",
"name": "foo",
"title": "Foo",
"type": "solution",
"version": "1.0.0"
}
]
1 change: 1 addition & 0 deletions search.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func getPackageOutput(packagesList map[string]map[string]*util.Package) ([]byte,
"name": m.Name,
"description": m.Description,
"version": m.Version,
"type": m.Type,
"download": "/package/" + m.Name + "-" + m.Version + ".tar.gz",
}
if m.Title != nil {
Expand Down
1 change: 1 addition & 0 deletions testdata/package/example-1.0.0/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ description: This is the example integration
version: 1.0.0
title: Example Integration
categories: ["logs", "metrics"]
type: integration

requirement:
elasticsearch:
Expand Down
1 change: 1 addition & 0 deletions testdata/package/foo-1.0.0/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ description: This is the foo integration
version: 1.0.0
title: Foo
categories: [metrics]
type: solution

requirement:
elasticsearch:
Expand Down
7 changes: 7 additions & 0 deletions util/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ import (
"gopkg.in/yaml.v2"
)

const defaultType = "integration"

type Package struct {
Name string `yaml:"name" json:"name"`
Title *string `yaml:"title,omitempty" json:"title,omitempty"`
Version string `yaml:"version" json:"version"`
versionSemVer semver.Version
Description string `yaml:"description" json:"description"`
Type string `yaml:"type" json:"type"`
Categories []string `yaml:"categories" json:"categories"`
Requirement struct {
Kibana struct {
Expand Down Expand Up @@ -57,6 +60,10 @@ func NewPackage(basePath, packageName string) (*Package, error) {
return nil, err
}

if p.Type == "" {
p.Type = defaultType
}

if p.Icons != nil {
for k, i := range p.Icons {
p.Icons[k].Src = i.getPath(p)
Expand Down

0 comments on commit 0c7e8c5

Please sign in to comment.