Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Renaming all Actions to distinguish between internal and external facing #284

Merged
merged 5 commits into from
Oct 22, 2020

Conversation

saratvemulapalli
Copy link
Contributor

*Issue #195 *

Description of changes:
Renaming all actions to distinguish between Internal facing vs external facing.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Oct 20, 2020

Codecov Report

Merging #284 into master will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #284      +/-   ##
============================================
+ Coverage     70.03%   70.07%   +0.04%     
- Complexity     1815     1820       +5     
============================================
  Files           190      190              
  Lines          8867     8900      +33     
  Branches        756      757       +1     
============================================
+ Hits           6210     6237      +27     
- Misses         2301     2306       +5     
- Partials        356      357       +1     
Flag Coverage Δ Complexity Δ
#cli 79.27% <ø> (ø) 0.00 <ø> (ø)
#plugin 69.27% <100.00%> (+0.05%) 1820.00 <19.00> (+5.00)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...istroforelasticsearch/ad/constant/CommonValue.java 75.00% <100.00%> (+25.00%) 1.00 <0.00> (ø)
...elasticsearch/ad/transport/ADResultBulkAction.java 80.00% <100.00%> (+5.00%) 2.00 <1.00> (ø)
...elasticsearch/ad/transport/ADStatsNodesAction.java 100.00% <100.00%> (ø) 2.00 <1.00> (ø)
...csearch/ad/transport/AnomalyDetectorJobAction.java 100.00% <100.00%> (ø) 2.00 <1.00> (ø)
...lasticsearch/ad/transport/AnomalyResultAction.java 100.00% <100.00%> (ø) 2.00 <1.00> (ø)
...istroforelasticsearch/ad/transport/CronAction.java 100.00% <100.00%> (ø) 2.00 <1.00> (ø)
...arch/ad/transport/DeleteAnomalyDetectorAction.java 100.00% <100.00%> (ø) 2.00 <1.00> (ø)
...relasticsearch/ad/transport/DeleteModelAction.java 100.00% <100.00%> (ø) 2.00 <1.00> (ø)
...lasticsearch/ad/transport/EntityProfileAction.java 100.00% <100.00%> (ø) 2.00 <1.00> (ø)
...elasticsearch/ad/transport/EntityResultAction.java 100.00% <100.00%> (ø) 2.00 <1.00> (ø)
... and 14 more

Copy link
Contributor

@ylwu-amzn ylwu-amzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the change.

@@ -23,7 +23,7 @@
public class ADResultBulkAction extends ActionType<BulkResponse> {

public static final ADResultBulkAction INSTANCE = new ADResultBulkAction();
//Internal Action which is not used for public facing RestAPIs.
// Internal Action which is not used for public facing RestAPIs.
public static final String NAME = "cluster:admin/opendistro/adinternal/write/bulk";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we put the internal and external action common prefix to CommonValue so that it is harder to have typo errors and easier to maintain in case that we want to change in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, thats a nice idea.
Will make a change.

@@ -19,7 +19,7 @@

public class AnomalyResultAction extends ActionType<AnomalyResultResponse> {
public static final AnomalyResultAction INSTANCE = new AnomalyResultAction();
//External Action which used for public facing RestAPIs.
// External Action which used for public facing RestAPIs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be internal since only background job runs it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also used in one of our Rest APIs which I wanted it to be external action :

client.execute(AnomalyResultAction.INSTANCE, getRequest, new RestToXContentListener<>(channel));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.

import org.elasticsearch.action.ActionType;

public class DeleteModelAction extends ActionType<DeleteModelResponse> {
public static final DeleteModelAction INSTANCE = new DeleteModelAction();
// Internal Action which is not used for public facing RestAPIs.
public static final String NAME = "cluster:admin/opendistro/adinternal/model/delete";
public static final String NAME = CommonValue.EXTERNAL_ACTION_PREFIX + "model/delete";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is internal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I did take care of it : )

@saratvemulapalli
Copy link
Contributor Author

This is breaking tests.
Some how the Actions do not take String concats. I'll take a look.

@saratvemulapalli
Copy link
Contributor Author

This is breaking tests.
Some how the Actions do not take String concats. I'll take a look.

Reordered INSTANCE and NAME statements to fix them, thanks @kaituo.

@saratvemulapalli saratvemulapalli merged commit ad02fd5 into master Oct 22, 2020
@saratvemulapalli saratvemulapalli deleted the fgac-rename-actions branch October 22, 2020 20:36
@ohltyler ohltyler added the enhancement New feature or request label Oct 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants