-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add command to tag a log group with current project and env
- Loading branch information
1 parent
7ae1b21
commit 880abb5
Showing
11 changed files
with
173 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package tw.com.commandline.actions; | ||
|
||
import com.amazonaws.services.cloudformation.model.Parameter; | ||
import org.apache.commons.cli.MissingArgumentException; | ||
import org.joda.time.DateTime; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import tw.com.AwsFacade; | ||
import tw.com.FacadeFactory; | ||
import tw.com.commandline.CommandLineException; | ||
import tw.com.entity.ProjectAndEnv; | ||
import tw.com.exceptions.CfnAssistException; | ||
|
||
import java.util.Collection; | ||
|
||
public class TagLogAction extends SharedAction { | ||
private static final Logger logger = LoggerFactory.getLogger(TagLogAction.class); | ||
|
||
@SuppressWarnings("static-access") | ||
public TagLogAction() { | ||
createOptionWithArgs("tagLog", "Tags the named group with current project and env", 1); | ||
} | ||
|
||
public void invoke(FacadeFactory factory, ProjectAndEnv projectAndEnv, Collection<Parameter> unused, | ||
Collection<Parameter> artifacts, String... args) throws CfnAssistException, MissingArgumentException, InterruptedException { | ||
logger.info("Invoking removeLogs for " + projectAndEnv + " and " + args[0]); | ||
AwsFacade aws = factory.createFacade(); | ||
String groupName = args[0]; | ||
aws.tagCloudWatchLog(projectAndEnv, groupName); | ||
} | ||
|
||
@Override | ||
public void validate(ProjectAndEnv projectAndEnv, Collection<Parameter> cfnParams, | ||
Collection<Parameter> artifacts, String... argumentForAction) | ||
throws CommandLineException { | ||
guardForProjectAndEnv(projectAndEnv); | ||
} | ||
|
||
@Override | ||
public boolean usesProject() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean usesComment() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean usesSNS() { | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters