Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #14249 to 7.5: Add Enterprise license type #14282

Merged
merged 2 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ https://github.com/elastic/beats/compare/v7.4.1...v7.5.0[View commits]

- Libbeat HTTP's Server can listen to a unix socket using the `unix:///tmp/hello.sock` syntax. {pull}13655[13655]
- Libbeat HTTP's Server can listen to a Windows named pipe using the `npipe:///hello` syntax. {pull}13655[13655]
- Adding new `Enterprise` license type to the licenser. {issue}14246[14246]

*Auditbeat*

Expand Down
14 changes: 0 additions & 14 deletions x-pack/libbeat/licenser/elastic_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,6 @@ var params = map[string]string{
"human": "false",
}

var stateLookup = map[string]State{
"inactive": Inactive,
"active": Active,
}

var licenseLookup = map[string]LicenseType{
"oss": OSS,
"trial": Trial,
"standard": Standard,
"basic": Basic,
"gold": Gold,
"platinum": Platinum,
}

// UnmarshalJSON takes a bytes array and convert it to the appropriate license type.
func (t *LicenseType) UnmarshalJSON(b []byte) error {
if len(b) <= 2 {
Expand Down
17 changes: 15 additions & 2 deletions x-pack/libbeat/licenser/licensetype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions x-pack/libbeat/licenser/state_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions x-pack/libbeat/licenser/testdata/xpack-with-enterprise.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"build": {
"hash": "053779d",
"date": "2018-07-20T05:25:16.206115Z"
},
"license": {
"uid": "936183d8-f48c-4a3f-959a-a52aa2563279",
"type": "enterprise",
"mode": "enterprise",
"status": "active",
"expiry_date_in_millis": 1588291199999
},
"features": {
"graph": {
"available": false,
"enabled": true
},
"logstash": {
"available": false,
"enabled": true
},
"ml": {
"available": false,
"enabled": true
},
"monitoring": {
"available": true,
"enabled": true
},
"rollup": {
"available": true,
"enabled": true
},
"security": {
"available": false,
"enabled": true
},
"watcher": {
"available": false,
"enabled": true
}
}
}
28 changes: 22 additions & 6 deletions x-pack/libbeat/licenser/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ type LicenseType int

//go:generate stringer -type=LicenseType -linecomment=true
const (
OSS LicenseType = iota // Open source
Trial // Trial
Basic // Basic
Standard // Standard
Gold // Gold
Platinum // Platinum
OSS LicenseType = iota // Open source
Trial // Trial
Basic // Basic
Standard // Standard
Gold // Gold
Platinum // Platinum
Enterprise // Enterprise
)

// State of the license can be active or inactive.
Expand All @@ -25,3 +26,18 @@ const (
Inactive State = iota
Active
)

var stateLookup = map[string]State{
"inactive": Inactive,
"active": Active,
}

var licenseLookup = map[string]LicenseType{
"oss": OSS,
"trial": Trial,
"standard": Standard,
"basic": Basic,
"gold": Gold,
"platinum": Platinum,
"enterprise": Enterprise,
}