Skip to content

Commit

Permalink
Assign all action scopes
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Crawford <steecraw@amazon.com>
  • Loading branch information
stephen-crawford committed Jun 2, 2023
1 parent 00f144e commit 30e7e7c
Show file tree
Hide file tree
Showing 247 changed files with 1,694 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased 2.x]
### Added
Introduce Limited Scopes for Extension Management ([#7850]https://github.com/opensearch-project/OpenSearch/pull/7850)

### Dependencies

Expand Down
7 changes: 5 additions & 2 deletions server/src/main/java/org/opensearch/action/ActionScopes.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
* @opensearch.experimental
*/
public enum ActionScopes implements Scope {
Cluster_Read(),
Cluster_ALL(),
Index_Read(),
// TODO: Write REST / Transport actions have not been covered
Index_ReadWrite();
Index_ReadWrite(),
Index_Search(),
Index_ALL();

public String getNamespace() {
return "Action";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@

package org.opensearch.action.admin.cluster.allocation;

import java.util.List;
import javax.swing.Action;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* ActionType for explaining shard allocation for a shard in the cluster
Expand All @@ -47,4 +51,9 @@ public class ClusterAllocationExplainAction extends ActionType<ClusterAllocation
private ClusterAllocationExplainAction() {
super(NAME, ClusterAllocationExplainResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_Read, ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@

package org.opensearch.action.admin.cluster.configuration;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* Transport endpoint for adding exclusions to voting config
Expand All @@ -45,4 +48,9 @@ public final class AddVotingConfigExclusionsAction extends ActionType<AddVotingC
private AddVotingConfigExclusionsAction() {
super(NAME, AddVotingConfigExclusionsResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@

package org.opensearch.action.admin.cluster.configuration;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* Transport endpoint for clearing exclusions to voting config
Expand All @@ -45,4 +48,9 @@ public class ClearVotingConfigExclusionsAction extends ActionType<ClearVotingCon
private ClearVotingConfigExclusionsAction() {
super(NAME, ClearVotingConfigExclusionsResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

package org.opensearch.action.admin.cluster.decommission.awareness.delete;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* Delete decommission state action.
Expand All @@ -22,4 +25,9 @@ public class DeleteDecommissionStateAction extends ActionType<DeleteDecommission
private DeleteDecommissionStateAction() {
super(NAME, DeleteDecommissionStateResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

package org.opensearch.action.admin.cluster.decommission.awareness.get;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* Get decommission action
Expand All @@ -23,4 +26,9 @@ public class GetDecommissionStateAction extends ActionType<GetDecommissionStateR
private GetDecommissionStateAction() {
super(NAME, GetDecommissionStateResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

package org.opensearch.action.admin.cluster.decommission.awareness.put;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* Register decommission action
Expand All @@ -22,4 +25,9 @@ public final class DecommissionAction extends ActionType<DecommissionResponse> {
private DecommissionAction() {
super(NAME, DecommissionResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

package org.opensearch.action.admin.cluster.health;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* Transport endpoint action for obtaining cluster health
Expand All @@ -47,4 +50,9 @@ public class ClusterHealthAction extends ActionType<ClusterHealthResponse> {
private ClusterHealthAction() {
super(NAME, ClusterHealthResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_Read, ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

package org.opensearch.action.admin.cluster.node.hotthreads;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* Transport action for requesting OpenSearch Hot Threads
Expand All @@ -47,4 +50,9 @@ public class NodesHotThreadsAction extends ActionType<NodesHotThreadsResponse> {
private NodesHotThreadsAction() {
super(NAME, NodesHotThreadsResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_Read, ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

package org.opensearch.action.admin.cluster.node.info;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* Transport action for OpenSearch Node Information
Expand All @@ -47,4 +50,9 @@ public class NodesInfoAction extends ActionType<NodesInfoResponse> {
private NodesInfoAction() {
super(NAME, NodesInfoResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_Read, ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

package org.opensearch.action.admin.cluster.node.reload;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* Transport action for reloading OpenSearch Secure Settings
Expand All @@ -47,4 +50,9 @@ public class NodesReloadSecureSettingsAction extends ActionType<NodesReloadSecur
private NodesReloadSecureSettingsAction() {
super(NAME, NodesReloadSecureSettingsResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

package org.opensearch.action.admin.cluster.node.stats;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* Transport action for obtaining OpenSearch Node Stats
Expand All @@ -47,4 +50,9 @@ public class NodesStatsAction extends ActionType<NodesStatsResponse> {
private NodesStatsAction() {
super(NAME, NodesStatsResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_Read, ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

package org.opensearch.action.admin.cluster.node.tasks.cancel;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* ActionType for cancelling running tasks
Expand All @@ -47,4 +50,9 @@ public class CancelTasksAction extends ActionType<CancelTasksResponse> {
private CancelTasksAction() {
super(NAME, CancelTasksResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

package org.opensearch.action.admin.cluster.node.tasks.get;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* ActionType for retrieving a list of currently running tasks
Expand All @@ -48,4 +51,9 @@ public class GetTaskAction extends ActionType<GetTaskResponse> {
private GetTaskAction() {
super(NAME, GetTaskResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_Read, ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

package org.opensearch.action.admin.cluster.node.tasks.list;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* ActionType for retrieving a list of currently running tasks
Expand All @@ -48,4 +51,9 @@ private ListTasksAction() {
super(NAME, ListTasksResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_Read, ActionScopes.Cluster_ALL);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

package org.opensearch.action.admin.cluster.node.usage;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* Transport action for collecting OpenSearch telemetry
Expand All @@ -47,4 +50,9 @@ public class NodesUsageAction extends ActionType<NodesUsageResponse> {
protected NodesUsageAction() {
super(NAME, NodesUsageResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_Read, ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

package org.opensearch.action.admin.cluster.remote;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* Transport action for remote monitoring
Expand All @@ -47,4 +50,9 @@ public final class RemoteInfoAction extends ActionType<RemoteInfoResponse> {
public RemoteInfoAction() {
super(NAME, RemoteInfoResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_Read, ActionScopes.Cluster_ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

package org.opensearch.action.admin.cluster.remotestore.restore;

import java.util.List;
import org.opensearch.action.ActionScopes;
import org.opensearch.action.ActionType;
import org.opensearch.identity.Scope;

/**
* Restore remote store action
Expand All @@ -23,4 +26,9 @@ public final class RestoreRemoteStoreAction extends ActionType<RestoreRemoteStor
private RestoreRemoteStoreAction() {
super(NAME, RestoreRemoteStoreResponse::new);
}

@Override
public List<Scope> allowedScopes() {
return List.of(ActionScopes.Cluster_ALL);
}
}
Loading

0 comments on commit 30e7e7c

Please sign in to comment.