-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into carlosdelest/fix-synonyms-ci-tests-timeout
- Loading branch information
Showing
997 changed files
with
18,728 additions
and
5,678 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,6 @@ steps: | |
matrix: | ||
setup: | ||
BWC_VERSION: | ||
- 7.17.13 | ||
- 8.9.1 | ||
- 8.10.0 | ||
agents: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
build-tools/src/main/java/org/elasticsearch/gradle/util/PlatformUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.gradle.util; | ||
|
||
import java.util.stream.Collectors; | ||
|
||
public class PlatformUtils { | ||
|
||
public static String normalize(String input) { | ||
return input.lines() | ||
.map(it -> it.replace('\\', '/')) | ||
.map(it -> it.replaceAll("\\d+\\.\\d\\ds", "0.00s")) | ||
.map(it -> it.replace("file:/./", "file:./")) | ||
.collect(Collectors.joining("\n")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...ement-runtime/src/main/java/org/elasticsearch/entitlement/runtime/policy/Entitlement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.entitlement.runtime.policy; | ||
|
||
/** | ||
* Marker interface to ensure that only {@link Entitlement} are | ||
* part of a {@link Policy}. All entitlement classes should implement | ||
* this. | ||
*/ | ||
public interface Entitlement { | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
...ntime/src/main/java/org/elasticsearch/entitlement/runtime/policy/ExternalEntitlement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.entitlement.runtime.policy; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* This annotation indicates an {@link Entitlement} is available | ||
* to "external" classes such as those used in plugins. Any {@link Entitlement} | ||
* using this annotation is considered parseable as part of a policy file | ||
* for entitlements. | ||
*/ | ||
@Target(ElementType.CONSTRUCTOR) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface ExternalEntitlement { | ||
|
||
/** | ||
* This is the list of parameter names that are | ||
* parseable in {@link PolicyParser#parseEntitlement(String, String)}. | ||
* The number and order of parameter names much match the number and order | ||
* of constructor parameters as this is how the parser will pass in the | ||
* parsed values from a policy file. However, the names themselves do NOT | ||
* have to match the parameter names of the constructor. | ||
*/ | ||
String[] parameterNames() default {}; | ||
} |
67 changes: 67 additions & 0 deletions
67
...t-runtime/src/main/java/org/elasticsearch/entitlement/runtime/policy/FileEntitlement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.entitlement.runtime.policy; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Describes a file entitlement with a path and actions. | ||
*/ | ||
public class FileEntitlement implements Entitlement { | ||
|
||
public static final int READ_ACTION = 0x1; | ||
public static final int WRITE_ACTION = 0x2; | ||
|
||
private final String path; | ||
private final int actions; | ||
|
||
@ExternalEntitlement(parameterNames = { "path", "actions" }) | ||
public FileEntitlement(String path, List<String> actionsList) { | ||
this.path = path; | ||
int actionsInt = 0; | ||
|
||
for (String actionString : actionsList) { | ||
if ("read".equals(actionString)) { | ||
if ((actionsInt & READ_ACTION) == READ_ACTION) { | ||
throw new IllegalArgumentException("file action [read] specified multiple times"); | ||
} | ||
actionsInt |= READ_ACTION; | ||
} else if ("write".equals(actionString)) { | ||
if ((actionsInt & WRITE_ACTION) == WRITE_ACTION) { | ||
throw new IllegalArgumentException("file action [write] specified multiple times"); | ||
} | ||
actionsInt |= WRITE_ACTION; | ||
} else { | ||
throw new IllegalArgumentException("unknown file action [" + actionString + "]"); | ||
} | ||
} | ||
|
||
this.actions = actionsInt; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
FileEntitlement that = (FileEntitlement) o; | ||
return actions == that.actions && Objects.equals(path, that.path); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(path, actions); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "FileEntitlement{" + "path='" + path + '\'' + ", actions=" + actions + '}'; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...ntitlement-runtime/src/main/java/org/elasticsearch/entitlement/runtime/policy/Policy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.entitlement.runtime.policy; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* A holder for scoped entitlements. | ||
*/ | ||
public class Policy { | ||
|
||
public final String name; | ||
public final List<Scope> scopes; | ||
|
||
public Policy(String name, List<Scope> scopes) { | ||
this.name = Objects.requireNonNull(name); | ||
this.scopes = Collections.unmodifiableList(Objects.requireNonNull(scopes)); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
Policy policy = (Policy) o; | ||
return Objects.equals(name, policy.name) && Objects.equals(scopes, policy.scopes); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(name, scopes); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Policy{" + "name='" + name + '\'' + ", scopes=" + scopes + '}'; | ||
} | ||
} |
Oops, something went wrong.