diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/SampleResourcePlugin.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/SampleResourcePlugin.java index a98b1b6993..26c23abacd 100644 --- a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/SampleResourcePlugin.java +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/SampleResourcePlugin.java @@ -40,15 +40,15 @@ import org.opensearch.rest.RestController; import org.opensearch.rest.RestHandler; import org.opensearch.script.ScriptService; -import org.opensearch.security.sample.actions.create.CreateSampleResourceAction; -import org.opensearch.security.sample.actions.create.CreateSampleResourceRestAction; -import org.opensearch.security.sample.actions.create.CreateSampleResourceTransportAction; -import org.opensearch.security.sample.actions.get.GetSampleResourceAction; -import org.opensearch.security.sample.actions.get.GetSampleResourceRestAction; -import org.opensearch.security.sample.actions.get.GetSampleResourceTransportAction; -import org.opensearch.security.sample.actions.list.ListSampleResourceAction; -import org.opensearch.security.sample.actions.list.ListSampleResourceRestAction; -import org.opensearch.security.sample.actions.list.ListSampleResourceTransportAction; +import org.opensearch.security.sample.actions.impl.create.CreateSampleResourceAction; +import org.opensearch.security.sample.actions.impl.create.CreateSampleResourceRestAction; +import org.opensearch.security.sample.actions.impl.create.CreateSampleResourceTransportAction; +import org.opensearch.security.sample.actions.impl.get.GetSampleResourceAction; +import org.opensearch.security.sample.actions.impl.get.GetSampleResourceRestAction; +import org.opensearch.security.sample.actions.impl.get.GetSampleResourceTransportAction; +import org.opensearch.security.sample.actions.impl.list.ListSampleResourceAction; +import org.opensearch.security.sample.actions.impl.list.ListSampleResourceRestAction; +import org.opensearch.security.sample.actions.impl.list.ListSampleResourceTransportAction; import org.opensearch.security.sample.actions.update.UpdateSampleResourceAction; import org.opensearch.security.sample.actions.update.UpdateSampleResourceRestAction; import org.opensearch.security.sample.actions.update.UpdateSampleResourceTransportAction; diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/create/CreateResourceRequest.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/create/CreateResourceRequest.java new file mode 100644 index 0000000000..387e6fc5cf --- /dev/null +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/create/CreateResourceRequest.java @@ -0,0 +1,50 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.security.sample.actions.generic.create; + +import java.io.IOException; + +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.core.common.io.stream.StreamInput; +import org.opensearch.core.common.io.stream.StreamOutput; +import org.opensearch.plugins.resource.Resource; + +/** + * Request object for CreateSampleResource transport action + */ +public class CreateResourceRequest extends ActionRequest { + + private final T resource; + + /** + * Default constructor + */ + public CreateResourceRequest(T resource) { + this.resource = resource; + } + + public CreateResourceRequest(StreamInput in, Reader resourceReader) throws IOException { + this.resource = resourceReader.read(in); + } + + @Override + public void writeTo(final StreamOutput out) throws IOException { + resource.writeTo(out); + } + + @Override + public ActionRequestValidationException validate() { + return null; + } + + public Resource getResource() { + return this.resource; + } +} diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/create/CreateResourceResponse.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/create/CreateResourceResponse.java new file mode 100644 index 0000000000..8eea97cc24 --- /dev/null +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/create/CreateResourceResponse.java @@ -0,0 +1,55 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.security.sample.actions.generic.create; + +import java.io.IOException; + +import org.opensearch.core.action.ActionResponse; +import org.opensearch.core.common.io.stream.StreamInput; +import org.opensearch.core.common.io.stream.StreamOutput; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; + +/** + * Response to a CreateSampleResourceRequest + */ +public class CreateResourceResponse extends ActionResponse implements ToXContentObject { + private final String resourceId; + + /** + * Default constructor + * + * @param resourceId The resourceId + */ + public CreateResourceResponse(String resourceId) { + this.resourceId = resourceId; + } + + @Override + public void writeTo(StreamOutput out) throws IOException { + out.writeString(resourceId); + } + + /** + * Constructor with StreamInput + * + * @param in the stream input + */ + public CreateResourceResponse(final StreamInput in) throws IOException { + resourceId = in.readString(); + } + + @Override + public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { + builder.startObject(); + builder.field("resourceId", resourceId); + builder.endObject(); + return builder; + } +} diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/create/CreateResourceTransportAction.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/create/CreateResourceTransportAction.java new file mode 100644 index 0000000000..bc1d589826 --- /dev/null +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/create/CreateResourceTransportAction.java @@ -0,0 +1,91 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.security.sample.actions.generic.create; + +import java.io.IOException; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import org.opensearch.action.admin.indices.create.CreateIndexRequest; +import org.opensearch.action.admin.indices.create.CreateIndexResponse; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.client.Client; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.core.action.ActionListener; +import org.opensearch.core.common.io.stream.Writeable; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.plugins.resource.Resource; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; + +import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; + +/** + * Transport action for CreateSampleResource. + */ +public class CreateResourceTransportAction extends HandledTransportAction< + CreateResourceRequest, + CreateResourceResponse> { + private static final Logger log = LogManager.getLogger(CreateResourceTransportAction.class); + + private final TransportService transportService; + private final Client nodeClient; + private final String resourceIndex; + + public CreateResourceTransportAction( + TransportService transportService, + ActionFilters actionFilters, + Client nodeClient, + String actionName, + String resourceIndex, + Writeable.Reader resourceReader + ) { + super(actionName, transportService, actionFilters, (in) -> new CreateResourceRequest(in, resourceReader)); + this.transportService = transportService; + this.nodeClient = nodeClient; + this.resourceIndex = resourceIndex; + } + + @Override + protected void doExecute(Task task, CreateResourceRequest request, ActionListener listener) { + try (ThreadContext.StoredContext ignore = transportService.getThreadPool().getThreadContext().stashContext()) { + CreateIndexRequest cir = new CreateIndexRequest(resourceIndex); + ActionListener cirListener = ActionListener.wrap( + response -> { createResource(request, listener); }, + (failResponse) -> { + /* Index already exists, ignore and continue */ + createResource(request, listener); + } + ); + nodeClient.admin().indices().create(cir, cirListener); + } + } + + private void createResource(CreateResourceRequest request, ActionListener listener) { + Resource sample = request.getResource(); + try { + IndexRequest ir = nodeClient.prepareIndex(resourceIndex) + .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE) + .setSource(sample.toXContent(jsonBuilder(), ToXContent.EMPTY_PARAMS)) + .request(); + + ActionListener irListener = ActionListener.wrap(idxResponse -> { + listener.onResponse(new CreateResourceResponse(idxResponse.getId())); + }, listener::onFailure); + nodeClient.index(ir, irListener); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/list/ListResourceRequest.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/list/ListResourceRequest.java new file mode 100644 index 0000000000..e35d48b338 --- /dev/null +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/list/ListResourceRequest.java @@ -0,0 +1,33 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.security.sample.actions.generic.list; + +import java.io.IOException; + +import org.opensearch.action.ResourceRequest; +import org.opensearch.core.common.io.stream.StreamInput; + +/** + * Request object for ListResource transport action + */ +public class ListResourceRequest extends ResourceRequest { + + // TODO Change this into Search instead of List + + /** + * Default constructor + */ + public ListResourceRequest(String resourceIndex) { + super(resourceIndex); + } + + public ListResourceRequest(StreamInput in) throws IOException { + super(in); + } +} diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/list/ListResourceResponse.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/list/ListResourceResponse.java new file mode 100644 index 0000000000..849fe0d8c9 --- /dev/null +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/list/ListResourceResponse.java @@ -0,0 +1,57 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.security.sample.actions.generic.list; + +import java.io.IOException; +import java.util.List; + +import org.opensearch.core.action.ActionResponse; +import org.opensearch.core.common.io.stream.StreamInput; +import org.opensearch.core.common.io.stream.StreamOutput; +import org.opensearch.core.xcontent.ToXContentObject; +import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.plugins.resource.Resource; + +/** + * Response to a ListResourceRequest + */ +public class ListResourceResponse extends ActionResponse implements ToXContentObject { + private final List resources; + + /** + * Default constructor + * + * @param resources The resources + */ + public ListResourceResponse(List resources) { + this.resources = resources; + } + + @Override + public void writeTo(StreamOutput out) throws IOException { + out.writeList(resources); + } + + /** + * Constructor with StreamInput + * + * @param in the stream input + */ + public ListResourceResponse(final StreamInput in, Reader resourceReader) throws IOException { + resources = in.readList(resourceReader); + } + + @Override + public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { + builder.startObject(); + builder.field("resources", resources); + builder.endObject(); + return builder; + } +} diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/list/ListResourceTransportAction.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/list/ListResourceTransportAction.java new file mode 100644 index 0000000000..39e429ce4b --- /dev/null +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/generic/list/ListResourceTransportAction.java @@ -0,0 +1,148 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.security.sample.actions.generic.list; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; + +import org.opensearch.OpenSearchException; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.client.Client; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.common.xcontent.LoggingDeprecationHandler; +import org.opensearch.common.xcontent.XContentHelper; +import org.opensearch.common.xcontent.XContentType; +import org.opensearch.core.action.ActionListener; +import org.opensearch.core.xcontent.NamedXContentRegistry; +import org.opensearch.core.xcontent.XContentParser; +import org.opensearch.index.query.MatchAllQueryBuilder; +import org.opensearch.plugins.resource.Resource; +import org.opensearch.plugins.resource.ResourceParser; +import org.opensearch.plugins.resource.ResourceSharingService; +import org.opensearch.search.SearchHit; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; + +/** + * Transport action for ListResource. + */ +public class ListResourceTransportAction extends HandledTransportAction> { + private final ResourceSharingService resourceSharingService; + + private final ResourceParser resourceParser; + + private final Client client; + + private final String resourceIndex; + + private final NamedXContentRegistry xContentRegistry; + + public ListResourceTransportAction( + TransportService transportService, + ActionFilters actionFilters, + String actionName, + String resourceIndex, + ResourceSharingService resourceSharingService, + ResourceParser resourceParser, + Client client, + NamedXContentRegistry xContentRegistry + ) { + super(actionName, transportService, actionFilters, ListResourceRequest::new); + this.client = client; + this.resourceSharingService = resourceSharingService; + this.resourceIndex = resourceIndex; + this.xContentRegistry = xContentRegistry; + Objects.requireNonNull(resourceParser); + this.resourceParser = resourceParser; + } + + @Override + protected void doExecute(Task task, ListResourceRequest request, ActionListener> listener) { + ActionListener> listResourceListener = ActionListener.wrap(resourcesList -> { + System.out.println("resourcesList: " + resourcesList); + listener.onResponse(new ListResourceResponse<>(resourcesList)); + }, listener::onFailure); + try (ThreadContext.StoredContext ignore = client.threadPool().getThreadContext().stashContext()) { + SearchRequest sr = new SearchRequest(resourceIndex); + SearchSourceBuilder matchAllQuery = new SearchSourceBuilder(); + matchAllQuery.query(new MatchAllQueryBuilder()); + sr.source(matchAllQuery); + ActionListener searchListener = new ActionListener<>() { + @Override + public void onResponse(SearchResponse searchResponse) { + List resources = new ArrayList<>(); + + SearchHit[] hits = searchResponse.getHits().getHits(); + + if (hits.length == 0) { + listResourceListener.onResponse(resources); + return; + } + + AtomicInteger remainingChecks = new AtomicInteger(hits.length); + + for (SearchHit hit : hits) { + try { + XContentParser parser = XContentHelper.createParser( + xContentRegistry, + LoggingDeprecationHandler.INSTANCE, + hit.getSourceRef(), + XContentType.JSON + ); + T resource = resourceParser.parse(parser, hit.getId()); + + ActionListener shareListener = new ActionListener<>() { + @Override + public void onResponse(Boolean isShared) { + if (isShared) { + synchronized (resources) { + resources.add(resource); + } + } + if (remainingChecks.decrementAndGet() == 0) { + listResourceListener.onResponse(resources); + } + } + + @Override + public void onFailure(Exception e) { + listResourceListener.onFailure( + new OpenSearchException("Failed to check sharing status: " + e.getMessage(), e) + ); + } + }; + + resourceSharingService.isSharedWithCurrentRequester(hit.getId(), shareListener); + + } catch (IOException e) { + listResourceListener.onFailure( + new OpenSearchException("Caught exception while loading resources: " + e.getMessage(), e) + ); + return; + } + } + listResourceListener.onResponse(resources); + } + + @Override + public void onFailure(Exception e) { + throw new OpenSearchException("Caught exception while loading resources: " + e.getMessage()); + } + }; + client.search(sr, searchListener); + } + } +} diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/create/CreateSampleResourceAction.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/create/CreateSampleResourceAction.java similarity index 84% rename from sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/create/CreateSampleResourceAction.java rename to sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/create/CreateSampleResourceAction.java index 1f6e0d388e..12397e1685 100644 --- a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/create/CreateSampleResourceAction.java +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/create/CreateSampleResourceAction.java @@ -6,10 +6,10 @@ * compatible open source license. */ -package org.opensearch.security.sample.actions.create; +package org.opensearch.security.sample.actions.impl.create; import org.opensearch.action.ActionType; -import org.opensearch.plugins.resource.action.create.CreateResourceResponse; +import org.opensearch.security.sample.actions.generic.create.CreateResourceResponse; /** * Action to create a sample resource diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/create/CreateSampleResourceRestAction.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/create/CreateSampleResourceRestAction.java similarity index 92% rename from sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/create/CreateSampleResourceRestAction.java rename to sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/create/CreateSampleResourceRestAction.java index 25abd1efde..50eeba2c98 100644 --- a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/create/CreateSampleResourceRestAction.java +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/create/CreateSampleResourceRestAction.java @@ -6,7 +6,7 @@ * compatible open source license. */ -package org.opensearch.security.sample.actions.create; +package org.opensearch.security.sample.actions.impl.create; import java.io.IOException; import java.util.List; @@ -14,10 +14,10 @@ import org.opensearch.client.node.NodeClient; import org.opensearch.core.xcontent.XContentParser; -import org.opensearch.plugins.resource.action.create.CreateResourceRequest; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.RestRequest; import org.opensearch.rest.action.RestToXContentListener; +import org.opensearch.security.sample.actions.generic.create.CreateResourceRequest; import org.opensearch.security.sample.resource.SampleResource; import static java.util.Collections.singletonList; diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/create/CreateSampleResourceTransportAction.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/create/CreateSampleResourceTransportAction.java similarity index 88% rename from sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/create/CreateSampleResourceTransportAction.java rename to sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/create/CreateSampleResourceTransportAction.java index 8492cdc0c0..ad9f5ff4b8 100644 --- a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/create/CreateSampleResourceTransportAction.java +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/create/CreateSampleResourceTransportAction.java @@ -6,7 +6,7 @@ * compatible open source license. */ -package org.opensearch.security.sample.actions.create; +package org.opensearch.security.sample.actions.impl.create; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -14,7 +14,7 @@ import org.opensearch.action.support.ActionFilters; import org.opensearch.client.Client; import org.opensearch.common.inject.Inject; -import org.opensearch.plugins.resource.action.create.CreateResourceTransportAction; +import org.opensearch.security.sample.actions.generic.create.CreateResourceTransportAction; import org.opensearch.security.sample.resource.SampleResource; import org.opensearch.transport.TransportService; diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/get/GetSampleResourceAction.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/get/GetSampleResourceAction.java similarity index 86% rename from sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/get/GetSampleResourceAction.java rename to sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/get/GetSampleResourceAction.java index d9fb5a2f1c..d8577e32ca 100644 --- a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/get/GetSampleResourceAction.java +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/get/GetSampleResourceAction.java @@ -6,10 +6,10 @@ * compatible open source license. */ -package org.opensearch.security.sample.actions.get; +package org.opensearch.security.sample.actions.impl.get; import org.opensearch.action.ActionType; -import org.opensearch.plugins.resource.action.get.GetResourceResponse; +import org.opensearch.plugins.resource.action.generic.get.GetResourceResponse; import org.opensearch.security.sample.resource.SampleResource; /** diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/get/GetSampleResourceRestAction.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/get/GetSampleResourceRestAction.java similarity index 91% rename from sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/get/GetSampleResourceRestAction.java rename to sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/get/GetSampleResourceRestAction.java index ed47cc88b9..707b0b2e12 100644 --- a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/get/GetSampleResourceRestAction.java +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/get/GetSampleResourceRestAction.java @@ -6,13 +6,13 @@ * compatible open source license. */ -package org.opensearch.security.sample.actions.get; +package org.opensearch.security.sample.actions.impl.get; import java.io.IOException; import java.util.List; import org.opensearch.client.node.NodeClient; -import org.opensearch.plugins.resource.action.get.GetResourceRequest; +import org.opensearch.plugins.resource.action.generic.get.GetResourceRequest; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.RestRequest; import org.opensearch.rest.action.RestToXContentListener; diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/get/GetSampleResourceTransportAction.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/get/GetSampleResourceTransportAction.java similarity index 91% rename from sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/get/GetSampleResourceTransportAction.java rename to sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/get/GetSampleResourceTransportAction.java index 8624db26bf..130cc93e98 100644 --- a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/get/GetSampleResourceTransportAction.java +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/get/GetSampleResourceTransportAction.java @@ -6,7 +6,7 @@ * compatible open source license. */ -package org.opensearch.security.sample.actions.get; +package org.opensearch.security.sample.actions.impl.get; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -15,7 +15,7 @@ import org.opensearch.client.Client; import org.opensearch.common.inject.Inject; import org.opensearch.core.xcontent.NamedXContentRegistry; -import org.opensearch.plugins.resource.action.get.GetResourceTransportAction; +import org.opensearch.plugins.resource.action.generic.get.GetResourceTransportAction; import org.opensearch.security.sample.resource.SampleResource; import org.opensearch.security.sample.resource.SampleResourceParser; import org.opensearch.security.sample.resource.SampleResourceType; diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/list/ListSampleResourceAction.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/list/ListSampleResourceAction.java similarity index 86% rename from sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/list/ListSampleResourceAction.java rename to sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/list/ListSampleResourceAction.java index dce5d1bc30..2a475a14d8 100644 --- a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/list/ListSampleResourceAction.java +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/list/ListSampleResourceAction.java @@ -6,10 +6,10 @@ * compatible open source license. */ -package org.opensearch.security.sample.actions.list; +package org.opensearch.security.sample.actions.impl.list; import org.opensearch.action.ActionType; -import org.opensearch.plugins.resource.action.list.ListResourceResponse; +import org.opensearch.security.sample.actions.generic.list.ListResourceResponse; import org.opensearch.security.sample.resource.SampleResource; /** diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/list/ListSampleResourceRestAction.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/list/ListSampleResourceRestAction.java similarity index 90% rename from sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/list/ListSampleResourceRestAction.java rename to sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/list/ListSampleResourceRestAction.java index 90ab48e985..9be954cdfb 100644 --- a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/list/ListSampleResourceRestAction.java +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/list/ListSampleResourceRestAction.java @@ -6,15 +6,15 @@ * compatible open source license. */ -package org.opensearch.security.sample.actions.list; +package org.opensearch.security.sample.actions.impl.list; import java.util.List; import org.opensearch.client.node.NodeClient; -import org.opensearch.plugins.resource.action.list.ListResourceRequest; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.RestRequest; import org.opensearch.rest.action.RestToXContentListener; +import org.opensearch.security.sample.actions.generic.list.ListResourceRequest; import static java.util.Collections.singletonList; import static org.opensearch.rest.RestRequest.Method.GET; diff --git a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/list/ListSampleResourceTransportAction.java b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/list/ListSampleResourceTransportAction.java similarity index 91% rename from sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/list/ListSampleResourceTransportAction.java rename to sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/list/ListSampleResourceTransportAction.java index 699ee15eda..b7731c4185 100644 --- a/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/list/ListSampleResourceTransportAction.java +++ b/sample-resource-plugin/src/main/java/org/opensearch/security/sample/actions/impl/list/ListSampleResourceTransportAction.java @@ -6,7 +6,7 @@ * compatible open source license. */ -package org.opensearch.security.sample.actions.list; +package org.opensearch.security.sample.actions.impl.list; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -15,7 +15,7 @@ import org.opensearch.client.Client; import org.opensearch.common.inject.Inject; import org.opensearch.core.xcontent.NamedXContentRegistry; -import org.opensearch.plugins.resource.action.list.ListResourceTransportAction; +import org.opensearch.security.sample.actions.generic.list.ListResourceTransportAction; import org.opensearch.security.sample.resource.SampleResource; import org.opensearch.security.sample.resource.SampleResourceParser; import org.opensearch.security.sample.resource.SampleResourceType;