-
Notifications
You must be signed in to change notification settings - Fork 180
Add support for writing resources and include more tests #4300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for writing resources and include more tests #4300
Conversation
Signed-off-by: Ashish Agrawal <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
… into write-resources
| private DirectQueryResourceType resourceType; | ||
| private String resourceName; | ||
| private String request; | ||
| private Map<String, String> RequestOptions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would the values ever need to be non-string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the request options so String should be safe here. The datasource that takes in this request to deserialize it to a non-string like an int if needed.
direct-query-core/src/main/java/org/opensearch/sql/prometheus/client/PrometheusClient.java
Show resolved
Hide resolved
.../main/java/org/opensearch/sql/directquery/rest/RestDirectQueryResourcesManagementAction.java
Show resolved
Hide resolved
...c/main/java/org/opensearch/sql/directquery/transport/format/DirectQueryRequestConverter.java
Outdated
Show resolved
Hide resolved
...va/org/opensearch/sql/directquery/transport/format/DirectQueryResourcesRequestConverter.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| public GetDirectQueryResourcesActionRequest(StreamInput in) throws IOException { | ||
| super(in); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious why remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was having test failures because this would require the input stream to have all the required params for the parent classes like needed a field like nodeId. Below is an example failure from the test testStreamConstructorWithAllFields in GetDirectQueryResourcesActionRequestTest.
> Task :direct-query:test FAILED
GetDirectQueryResourcesActionRequestTest > testStreamConstructorWithAllFields() FAILED
java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because "nodeId" is null
at org.opensearch.core.tasks.TaskId.readFromStream(TaskId.java:99)
at org.opensearch.transport.TransportRequest.<init>(TransportRequest.java:74)
at org.opensearch.action.ActionRequest.<init>(ActionRequest.java:58)
at org.opensearch.sql.directquery.transport.model.GetDirectQueryResourcesActionRequest.<init>(GetDirectQueryResourcesActionRequest.java:29)
at org.opensearch.sql.directquery.transport.model.GetDirectQueryResourcesActionRequestTest.testStreamConstructorWithAllFields(GetDirectQueryResourcesActionRequestTest.java:54)
Signed-off-by: Ashish Agrawal <[email protected]>
...rc/main/java/org/opensearch/sql/directquery/rest/model/WriteDirectQueryResourcesRequest.java
Show resolved
Hide resolved
...rc/main/java/org/opensearch/sql/directquery/rest/model/WriteDirectQueryResourcesRequest.java
Show resolved
Hide resolved
direct-query-core/src/main/java/org/opensearch/sql/prometheus/client/PrometheusClientImpl.java
Outdated
Show resolved
Hide resolved
direct-query-core/src/main/java/org/opensearch/sql/prometheus/query/PrometheusQueryHandler.java
Outdated
Show resolved
Hide resolved
|
|
||
| private final DirectQueryExecutorService directQueryExecutorService; | ||
|
|
||
| public static final String NAME = "indices:data/write/direct_query_resources"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is indices:data correct namespace? What is the rationale behind this?
public static final String NAME = "cluster:admin/opensearch/ql/datasources/read";
For example we are using the above for GetDatasourcesQueryRequest. The rationale here is that datasources are cluster level resource which admin can configure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[NIT] Also, we need to create an issue for making changes in security dashboards plugin to include all the new permissions.
Signed-off-by: Ashish Agrawal <[email protected]>
vamsimanohar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I think we still need to think through on what to use for permissions.
cluster:admin/opensearch/direct_query/write/resources
Is this for more granular level permissions on what data sources the users would have access to? But I agree before going GA with the feature, we need to have this get more feedback from the community as well. |
933c6b5
into
opensearch-project:feature/direct-query-prometheus
Description
Add support for writing resources and include more tests.
Fixed many experimental tag placements.
Related Issues
Resolves N/A
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.