@@ -36,6 +36,7 @@ public class XPackLicenseState {
36
36
* Each value defines the licensed state necessary for the feature to be allowed.
37
37
*/
38
38
public enum Feature {
39
+ SECURITY (OperationMode .BASIC , false ),
39
40
SECURITY_IP_FILTERING (OperationMode .GOLD , false ),
40
41
SECURITY_AUDITING (OperationMode .GOLD , false ),
41
42
SECURITY_DLS_FLS (OperationMode .PLATINUM , false ),
@@ -46,7 +47,49 @@ public enum Feature {
46
47
SECURITY_API_KEY_SERVICE (OperationMode .MISSING , false ),
47
48
SECURITY_AUTHORIZATION_REALM (OperationMode .PLATINUM , true ),
48
49
SECURITY_AUTHORIZATION_ENGINE (OperationMode .PLATINUM , true ),
49
- SPATIAL_GEO_CENTROID (OperationMode .GOLD , true );
50
+ SECURITY_STATS_AND_HEALTH (OperationMode .MISSING , true ),
51
+
52
+ WATCHER (OperationMode .STANDARD , true ),
53
+ MONITORING (OperationMode .MISSING , true ),
54
+ // TODO: should just check WATCHER directly?
55
+ MONITORING_CLUSTER_ALERTS (OperationMode .STANDARD , true ),
56
+ MONITORING_UPDATE_RETENTION (OperationMode .STANDARD , false ),
57
+
58
+ CCR (OperationMode .PLATINUM , true ),
59
+
60
+ GRAPH (OperationMode .PLATINUM , true ),
61
+
62
+ MACHINE_LEARNING (OperationMode .PLATINUM , true ),
63
+
64
+ TRANSFORM (OperationMode .MISSING , true ),
65
+
66
+ ROLLUP (OperationMode .MISSING , true ),
67
+
68
+ VOTING_ONLY (OperationMode .MISSING , true ),
69
+
70
+ LOGSTASH (OperationMode .STANDARD , true ),
71
+
72
+ DEPRECATION (OperationMode .MISSING , true ),
73
+
74
+ ILM (OperationMode .MISSING , true ),
75
+
76
+ ENRICH (OperationMode .MISSING , true ),
77
+
78
+ EQL (OperationMode .MISSING , true ),
79
+
80
+ SQL (OperationMode .MISSING , true ),
81
+
82
+ JDBC (OperationMode .PLATINUM , true ),
83
+
84
+ ODBC (OperationMode .PLATINUM , true ),
85
+
86
+ VECTORS (OperationMode .MISSING , true ),
87
+
88
+ SPATIAL (OperationMode .MISSING , true ),
89
+
90
+ SPATIAL_GEO_CENTROID (OperationMode .GOLD , true ),
91
+
92
+ ANALYTICS (OperationMode .MISSING , true );
50
93
51
94
final OperationMode minimumOperationMode ;
52
95
final boolean needsActive ;
@@ -432,57 +475,10 @@ public boolean isAllowed(Feature feature) {
432
475
return isAllowedByLicense (feature .minimumOperationMode , feature .needsActive );
433
476
}
434
477
435
- public boolean isStatsAndHealthAllowed () {
436
- return allowForAllLicenses ();
437
- }
438
-
439
- public boolean isWatcherAllowed () {
440
- return isAllowedByLicense (OperationMode .STANDARD );
441
- }
442
-
443
- public boolean isMonitoringAllowed () {
444
- return allowForAllLicenses ();
445
- }
446
-
447
- /**
448
- * Monitoring Cluster Alerts requires the equivalent license to use Watcher.
449
- *
450
- * @return {@link #isWatcherAllowed()}
451
- * @see #isWatcherAllowed()
452
- */
453
- public boolean isMonitoringClusterAlertsAllowed () {
454
- return isWatcherAllowed ();
455
- }
456
-
457
- /**
458
- * Determine if the current license allows the retention of indices to be modified.
459
- * <p>
460
- * Only users with a non-{@link OperationMode#BASIC} license can update the retention period.
461
- * <p>
462
- * Note: This does not consider the <em>state</em> of the license so that any change is remembered for when they fix their license.
463
- *
464
- * @return {@code true} if the user is allowed to modify the retention. Otherwise {@code false}.
465
- */
466
- public boolean isUpdateRetentionAllowed () {
467
- return isAllowedByLicense (OperationMode .STANDARD , false );
468
- }
469
-
470
- public boolean isGraphAllowed () {
471
- return isAllowedByLicense (OperationMode .PLATINUM );
472
- }
473
-
474
- public boolean isMachineLearningAllowed () {
475
- return isAllowedByLicense (OperationMode .PLATINUM );
476
- }
477
-
478
478
public static boolean isMachineLearningAllowedForOperationMode (final OperationMode operationMode ) {
479
479
return isAllowedByOperationMode (operationMode , OperationMode .PLATINUM );
480
480
}
481
481
482
- public boolean isTransformAllowed () {
483
- return allowForAllLicenses ();
484
- }
485
-
486
482
public static boolean isTransformAllowedForOperationMode (final OperationMode operationMode ) {
487
483
// any license (basic and upwards)
488
484
return operationMode != License .OperationMode .MISSING ;
@@ -492,91 +488,6 @@ public static boolean isFipsAllowedForOperationMode(final OperationMode operatio
492
488
return isAllowedByOperationMode (operationMode , OperationMode .PLATINUM );
493
489
}
494
490
495
- public boolean isRollupAllowed () {
496
- return allowForAllLicenses ();
497
- }
498
-
499
- public boolean isVotingOnlyAllowed () {
500
- return allowForAllLicenses ();
501
- }
502
-
503
- public boolean isLogstashAllowed () {
504
- return isAllowedByLicense (OperationMode .STANDARD );
505
- }
506
-
507
- public boolean isBeatsAllowed () {
508
- return isAllowedByLicense (OperationMode .STANDARD );
509
- }
510
-
511
- public boolean isDeprecationAllowed () {
512
- return allowForAllLicenses ();
513
- }
514
-
515
- public boolean isUpgradeAllowed () {
516
- return allowForAllLicenses ();
517
- }
518
-
519
- public boolean isIndexLifecycleAllowed () {
520
- return allowForAllLicenses ();
521
- }
522
-
523
- public boolean isEnrichAllowed () {
524
- return allowForAllLicenses ();
525
- }
526
-
527
- public boolean isEqlAllowed () {
528
- return allowForAllLicenses ();
529
- }
530
-
531
- public boolean isSqlAllowed () {
532
- return allowForAllLicenses ();
533
- }
534
-
535
- public boolean isJdbcAllowed () {
536
- return isAllowedByLicense (OperationMode .PLATINUM );
537
- }
538
-
539
- public boolean isFlattenedAllowed () {
540
- return allowForAllLicenses ();
541
- }
542
-
543
- public boolean isVectorsAllowed () {
544
- return allowForAllLicenses ();
545
- }
546
-
547
-
548
- /**
549
- * Determine if Wildcard support should be enabled.
550
- * <p>
551
- * Wildcard is available for all license types except {@link OperationMode#MISSING}
552
- */
553
- public synchronized boolean isWildcardAllowed () {
554
- return status .active ;
555
- }
556
-
557
- public boolean isOdbcAllowed () {
558
- return isAllowedByLicense (OperationMode .PLATINUM );
559
- }
560
-
561
- public boolean isSpatialAllowed () {
562
- return allowForAllLicenses ();
563
- }
564
-
565
- public boolean isAnalyticsAllowed () {
566
- return allowForAllLicenses ();
567
- }
568
-
569
- public boolean isConstantKeywordAllowed () {
570
- return allowForAllLicenses ();
571
- }
572
-
573
- /**
574
- * @return true if security is available to be used with the current license type
575
- */
576
- public boolean isSecurityAvailable () {
577
- return checkAgainstStatus (status -> status .mode != OperationMode .MISSING );
578
- }
579
-
580
491
/**
581
492
* Returns whether security is enabled, taking into account the default enabled state
582
493
* based on the current license level.
@@ -616,13 +527,6 @@ private static boolean isSecurityEnabled(final OperationMode mode, final boolean
616
527
}
617
528
}
618
529
619
- /**
620
- * Determine if cross-cluster replication is allowed
621
- */
622
- public boolean isCcrAllowed () {
623
- return isAllowedByLicense (OperationMode .PLATINUM );
624
- }
625
-
626
530
public static boolean isCcrAllowedForOperationMode (final OperationMode operationMode ) {
627
531
return isAllowedByOperationMode (operationMode , OperationMode .PLATINUM );
628
532
}
0 commit comments