Skip to content

Commit

Permalink
Add Enterprise license type (#14249) (#14282)
Browse files Browse the repository at this point in the history
* Add Enterprise license type

Add the Enterprise license type and regenerate the types files.

Fixes: #14246
(cherry picked from commit 5f06f19)
  • Loading branch information
ph committed Oct 28, 2019
1 parent 1f8de66 commit 09376da
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 22 deletions.
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,
}

0 comments on commit 09376da

Please sign in to comment.