Skip to content

Commit

Permalink
modify based on commit
Browse files Browse the repository at this point in the history
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
  • Loading branch information
ruai0511 committed Jun 19, 2024
1 parent fd9ecee commit d490c15
Show file tree
Hide file tree
Showing 51 changed files with 201 additions and 593 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Add task completion count in search backpressure stats API ([#10028](https://github.com/opensearch-project/OpenSearch/pull/10028/))
- Deprecate CamelCase `PathHierarchy` tokenizer name in favor to lowercase `path_hierarchy` ([#10894](https://github.com/opensearch-project/OpenSearch/pull/10894))
- Breaking change: Do not request "search_pipelines" metrics by default in NodesInfoRequest ([#12497](https://github.com/opensearch-project/OpenSearch/pull/12497))
- [Query Sandbox] Add Resource Limit Group CRUD APIs ([#13315](https://github.com/opensearch-project/OpenSearch/pull/13315))
- [QueryGroup] Add QueryGroup CRUD APIs ([#13315](https://github.com/opensearch-project/OpenSearch/pull/13315))

### Deprecated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

opensearchplugin {
description 'OpenSearch QueryGroup Plugin.'
classname 'org.opensearch.plugin.qg.QueryGroupPlugin'
description 'OpenSearch Workload Management Plugin.'
classname 'org.opensearch.plugin.wlm.WorkloadManagementPlugin'
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.action.ActionType;

Expand All @@ -25,7 +25,7 @@ public class CreateQueryGroupAction extends ActionType<CreateQueryGroupResponse>
/**
* Name for CreateQueryGroupAction
*/
public static final String NAME = "cluster:admin/opensearch/query_group/_create";
public static final String NAME = "cluster:admin/opensearch/query_group/wlm/_create";

/**
* Default constructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.action.ActionRequest;
import org.opensearch.action.ActionRequestValidationException;
Expand Down Expand Up @@ -123,6 +123,7 @@ private void verifyCreateQueryGroupRequest(
Objects.requireNonNull(updatedAtInMillis, "QueryGroup.updatedAtInMillis can't be null");

validateName(name);
validateMode(mode);
validateResourceLimits(resourceLimits);
validateUpdatedAtInMillis(updatedAtInMillis);
}
Expand All @@ -146,6 +147,16 @@ public static void validateName(String name) {
}
}

/**
* Verification for CreateQueryGroupRequest.mode
* @param mode - mode to be verified
*/
public static void validateMode(QueryGroupMode mode) {
if (!mode.getName().equals("monitor")) {
throw new IllegalArgumentException("QueryGroup.mode must be monitor");
}
}

/**
* Verification for CreateQueryGroupRequest.resourceLimits
* @param resourceLimits - resourceLimits to be verified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.cluster.metadata.QueryGroup;
import org.opensearch.core.action.ActionResponse;
Expand All @@ -30,17 +30,12 @@ public class CreateQueryGroupResponse extends ActionResponse implements ToXConte

/**
* Constructor for CreateQueryGroupResponse
* @param queryGroup - The QueryGroup to be created
* @param restStatus - The resStatus for the response
*/
public CreateQueryGroupResponse() {
this.queryGroup = null;
}

/**
* Constructor for CreateQueryGroupResponse
* @param queryGroup - The resource limit group to be created
*/
public CreateQueryGroupResponse(final QueryGroup queryGroup) {
public CreateQueryGroupResponse(final QueryGroup queryGroup, RestStatus restStatus) {
this.queryGroup = queryGroup;
this.restStatus = restStatus;
}

/**
Expand All @@ -49,11 +44,13 @@ public CreateQueryGroupResponse(final QueryGroup queryGroup) {
*/
public CreateQueryGroupResponse(StreamInput in) throws IOException {
queryGroup = new QueryGroup(in);
restStatus = RestStatus.readFrom(in);
}

@Override
public void writeTo(StreamOutput out) throws IOException {
queryGroup.writeTo(out);
RestStatus.writeTo(out, restStatus);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.action.ActionType;

Expand All @@ -18,15 +18,15 @@
public class DeleteQueryGroupAction extends ActionType<DeleteQueryGroupResponse> {

/**
/**
/**
* An instance of DeleteQueryGroupAction
*/
public static final DeleteQueryGroupAction INSTANCE = new DeleteQueryGroupAction();

/**
* Name for DeleteQueryGroupAction
*/
public static final String NAME = "cluster:admin/opensearch/query_group/_delete";
public static final String NAME = "cluster:admin/opensearch/query_group/wlm/_delete";

/**
* Default constructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.action.ActionRequest;
import org.opensearch.action.ActionRequestValidationException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.cluster.metadata.QueryGroup;
import org.opensearch.core.action.ActionResponse;
Expand All @@ -29,19 +29,14 @@ public class DeleteQueryGroupResponse extends ActionResponse implements ToXConte
private final List<QueryGroup> queryGroups;
private RestStatus restStatus;

/**
* Constructor for DeleteQueryGroupResponse
*/
public DeleteQueryGroupResponse() {
this.queryGroups = null;
}

/**
* Constructor for DeleteQueryGroupResponse
* @param queryGroups - The QueryGroup list to be fetched
* @param restStatus - The rest status for this response
*/
public DeleteQueryGroupResponse(final List<QueryGroup> queryGroups) {
public DeleteQueryGroupResponse(final List<QueryGroup> queryGroups, RestStatus restStatus) {
this.queryGroups = queryGroups;
this.restStatus = restStatus;
}

/**
Expand All @@ -50,11 +45,13 @@ public DeleteQueryGroupResponse(final List<QueryGroup> queryGroups) {
*/
public DeleteQueryGroupResponse(StreamInput in) throws IOException {
this.queryGroups = in.readList(QueryGroup::new);
this.restStatus = RestStatus.readFrom(in);
}

@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeList(queryGroups);
RestStatus.writeTo(out, restStatus);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.action.ActionType;

Expand All @@ -26,7 +26,7 @@ public class GetQueryGroupAction extends ActionType<GetQueryGroupResponse> {
/**
* Name for GetQueryGroupAction
*/
public static final String NAME = "cluster:admin/opensearch/query_group/_get";
public static final String NAME = "cluster:admin/opensearch/query_group/wlm/_get";

/**
* Default constructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.action.ActionRequest;
import org.opensearch.action.ActionRequestValidationException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.cluster.metadata.QueryGroup;
import org.opensearch.core.action.ActionResponse;
Expand All @@ -29,19 +29,14 @@ public class GetQueryGroupResponse extends ActionResponse implements ToXContent,
private final List<QueryGroup> queryGroups;
private RestStatus restStatus;

/**
* Constructor for GetQueryGroupResponse
*/
public GetQueryGroupResponse() {
this.queryGroups = null;
}

/**
* Constructor for GetQueryGroupResponse
* @param queryGroups - The QueryGroup list to be fetched
* @param restStatus - The rest status of the request
*/
public GetQueryGroupResponse(final List<QueryGroup> queryGroups) {
public GetQueryGroupResponse(final List<QueryGroup> queryGroups, RestStatus restStatus) {
this.queryGroups = queryGroups;
this.restStatus = restStatus;
}

/**
Expand All @@ -50,11 +45,13 @@ public GetQueryGroupResponse(final List<QueryGroup> queryGroups) {
*/
public GetQueryGroupResponse(StreamInput in) throws IOException {
this.queryGroups = in.readList(QueryGroup::new);
restStatus = RestStatus.readFrom(in);
}

@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeList(queryGroups);
RestStatus.writeTo(out, restStatus);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.HandledTransportAction;
import org.opensearch.cluster.metadata.QueryGroup;
import org.opensearch.common.inject.Inject;
import org.opensearch.core.action.ActionListener;
import org.opensearch.plugin.qg.service.Persistable;
import org.opensearch.plugin.wlm.service.Persistable;
import org.opensearch.tasks.Task;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TransportService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.HandledTransportAction;
import org.opensearch.cluster.metadata.QueryGroup;
import org.opensearch.common.inject.Inject;
import org.opensearch.core.action.ActionListener;
import org.opensearch.plugin.qg.service.Persistable;
import org.opensearch.plugin.wlm.service.Persistable;
import org.opensearch.tasks.Task;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TransportService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.HandledTransportAction;
import org.opensearch.cluster.metadata.QueryGroup;
import org.opensearch.common.inject.Inject;
import org.opensearch.core.action.ActionListener;
import org.opensearch.plugin.qg.service.Persistable;
import org.opensearch.plugin.wlm.service.Persistable;
import org.opensearch.tasks.Task;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TransportService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.HandledTransportAction;
import org.opensearch.cluster.metadata.QueryGroup;
import org.opensearch.common.inject.Inject;
import org.opensearch.core.action.ActionListener;
import org.opensearch.plugin.qg.service.Persistable;
import org.opensearch.plugin.wlm.service.Persistable;
import org.opensearch.tasks.Task;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TransportService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.plugin.qg;
package org.opensearch.plugin.wlm;

import org.opensearch.action.ActionType;

Expand All @@ -25,7 +25,7 @@ public class UpdateQueryGroupAction extends ActionType<UpdateQueryGroupResponse>
/**
* Name for UpdateQueryGroupAction
*/
public static final String NAME = "cluster:admin/opensearch/query_group/_update";
public static final String NAME = "cluster:admin/opensearch/query_group/wlm/_update";

/**
* Default constructor
Expand Down
Loading

0 comments on commit d490c15

Please sign in to comment.