Skip to content

Commit 2325679

Browse files
committed
add new arcs subcommand exec
this allows for execution of arcs by lot or time range
1 parent f038119 commit 2325679

File tree

55 files changed

+1062
-430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1062
-430
lines changed

build-logic/src/main/kotlin/clusterless.java-common-conventions.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ dependencies {
151151
implementationAndTestFixture("software.amazon.awssdk:sqs:$awsSdk")
152152
implementationAndTestFixture("software.amazon.awssdk:glue:$awsSdk")
153153
implementationAndTestFixture("software.amazon.awssdk:athena:$awsSdk")
154+
implementationAndTestFixture("software.amazon.awssdk:sfn:$awsSdk")
154155

155156
// https://github.com/aws/aws-lambda-java-libs
156157
implementationAndTestFixture("com.amazonaws:aws-lambda-java-core:1.2.3")

clusterless-main-common/src/main/java/clusterless/cls/command/report/ReportCommandOptions.java renamed to clusterless-main-common/src/main/java/clusterless/cls/command/common/CommonCommandOptions.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
77
*/
88

9-
package clusterless.cls.command.report;
9+
package clusterless.cls.command.common;
1010

11-
import clusterless.cls.command.CommonCommandOptions;
1211
import picocli.CommandLine;
1312

1413
/**
@@ -18,7 +17,7 @@
1817
description = "",
1918
subcommands = {CommandLine.HelpCommand.class}
2019
)
21-
public abstract class ReportCommandOptions extends CommonCommandOptions {
20+
public abstract class CommonCommandOptions extends clusterless.cls.command.CommonCommandOptions {
2221
public abstract String profile();
2322

2423
public abstract String account();

clusterless-main-common/src/main/java/clusterless/cls/command/report/ReportOptions.java renamed to clusterless-main-common/src/main/java/clusterless/cls/command/common/CommonOptions.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
77
*/
88

9-
package clusterless.cls.command.report;
9+
package clusterless.cls.command.common;
1010

1111
import picocli.CommandLine;
1212

13-
public class ReportOptions {
13+
public class CommonOptions {
1414
@CommandLine.Option(
1515
names = "--profile",
1616
description = "Cloud profile."
@@ -34,22 +34,22 @@ public class ReportOptions {
3434
)
3535
String stage;
3636

37-
public ReportOptions setProfile(String profile) {
37+
public CommonOptions setProfile(String profile) {
3838
this.profile = profile;
3939
return this;
4040
}
4141

42-
public ReportOptions setAccount(String account) {
42+
public CommonOptions setAccount(String account) {
4343
this.account = account;
4444
return this;
4545
}
4646

47-
public ReportOptions setRegion(String region) {
47+
public CommonOptions setRegion(String region) {
4848
this.region = region;
4949
return this;
5050
}
5151

52-
public ReportOptions setStage(String stage) {
52+
public CommonOptions setStage(String stage) {
5353
this.stage = stage;
5454
return this;
5555
}

clusterless-main-common/src/main/java/clusterless/cls/command/report/RangeOptions.java renamed to clusterless-main-common/src/main/java/clusterless/cls/command/common/RangeOptions.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
77
*/
88

9-
package clusterless.cls.command.report;
9+
package clusterless.cls.command.common;
1010

1111
import clusterless.cls.util.Moment;
1212
import clusterless.cls.util.MomentTypeConverter;
@@ -16,7 +16,7 @@ public class RangeOptions {
1616
@CommandLine.Option(
1717
names = {"--earliest"},
1818
description = {
19-
"Earliest time to include in report, inclusive.",
19+
"Earliest time to include, inclusive.",
2020
"Where the time can be most any date/time format, or",
2121
"an adjuster such as '1h' or '1d'.",
2222
"(default: ${DEFAULT-VALUE})"
@@ -28,7 +28,7 @@ public class RangeOptions {
2828
@CommandLine.Option(
2929
names = {"--latest"},
3030
description = {
31-
"Latest time to include in report, exclusive.",
31+
"Latest time to include, exclusive.",
3232
"Where the time can be most any date/time format, or",
3333
"an adjuster such as '1h' or '1d'.",
3434
"(default: ${DEFAULT-VALUE})"

clusterless-main-common/src/main/java/clusterless/cls/command/report/ArcReportOptions.java renamed to clusterless-main-common/src/main/java/clusterless/cls/command/entity/ArcCommonOptions.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,23 @@
66
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
77
*/
88

9-
package clusterless.cls.command.report;
9+
package clusterless.cls.command.entity;
1010

11+
import clusterless.cls.command.common.CommonOptions;
1112
import picocli.CommandLine;
1213

1314
import java.util.LinkedList;
1415
import java.util.List;
1516

16-
public class ArcReportOptions extends ReportOptions {
17+
public class ArcCommonOptions extends CommonOptions {
1718
@CommandLine.Option(
1819
names = {"--project"},
1920
split = ",",
2021
description = "Filter results by project, and optionally version. (e.g. 'project:version')"
2122
)
2223
List<String> projects = new LinkedList<>();
2324

24-
public ArcReportOptions setProjects(List<String> projects) {
25+
public ArcCommonOptions setProjects(List<String> projects) {
2526
this.projects = projects;
2627
return this;
2728
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (c) 2023-2025 Chris K Wensel <chris@wensel.net>. All Rights Reserved.
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+
*/
8+
9+
package clusterless.cls.command.entity;
10+
11+
import clusterless.cls.command.common.CommonCommandOptions;
12+
import clusterless.cls.command.common.CommonOptions;
13+
import picocli.CommandLine;
14+
15+
import java.util.List;
16+
17+
public class ArcsCommandOptions extends CommonCommandOptions {
18+
@CommandLine.Mixin
19+
ArcCommonOptions arcCommonOptions = new ArcCommonOptions();
20+
21+
public void setArcCommonOptions(ArcCommonOptions arcCommonOptions) {
22+
this.arcCommonOptions = arcCommonOptions;
23+
}
24+
25+
public ArcCommonOptions setProjects(List<String> projects) {
26+
return arcCommonOptions.setProjects(projects);
27+
}
28+
29+
public CommonOptions setProfile(String profile) {
30+
return arcCommonOptions.setProfile(profile);
31+
}
32+
33+
public CommonOptions setAccount(String account) {
34+
return arcCommonOptions.setAccount(account);
35+
}
36+
37+
public CommonOptions setRegion(String region) {
38+
return arcCommonOptions.setRegion(region);
39+
}
40+
41+
public CommonOptions setStage(String stage) {
42+
return arcCommonOptions.setStage(stage);
43+
}
44+
45+
public List<String> projects() {
46+
return arcCommonOptions.projects();
47+
}
48+
49+
public String profile() {
50+
return arcCommonOptions.profile();
51+
}
52+
53+
public String account() {
54+
return arcCommonOptions.account();
55+
}
56+
57+
public String region() {
58+
return arcCommonOptions.region();
59+
}
60+
61+
public String stage() {
62+
return arcCommonOptions.stage();
63+
}
64+
}
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/*
2+
* Copyright (c) 2023-2025 Chris K Wensel <chris@wensel.net>. All Rights Reserved.
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+
*/
8+
9+
package clusterless.cls.command.exec;
10+
11+
import clusterless.cls.command.CommonCommandOptions;
12+
import clusterless.cls.command.common.CommonOptions;
13+
import clusterless.cls.command.common.RangeOptions;
14+
import clusterless.cls.command.entity.ArcCommonOptions;
15+
import clusterless.cls.model.state.ArcState;
16+
import clusterless.cls.util.Moment;
17+
import picocli.CommandLine;
18+
19+
import java.util.LinkedList;
20+
import java.util.List;
21+
22+
public class ArcExecCommandOptions extends CommonCommandOptions {
23+
@CommandLine.Mixin
24+
ArcCommonOptions arcCommonOptions = new ArcCommonOptions();
25+
26+
static class RangeOrLot {
27+
@CommandLine.ArgGroup(
28+
exclusive = false,
29+
heading = "Time Range Options:%n"
30+
)
31+
RangeOptions rangeOptions = new RangeOptions();
32+
33+
@CommandLine.Option(
34+
names = {"--lot"},
35+
split = ",",
36+
description = "Apply to only these lots."
37+
)
38+
List<String> lots = new LinkedList<>();
39+
}
40+
41+
@CommandLine.ArgGroup(
42+
heading = "Time Range or Lot Options:%n"
43+
)
44+
RangeOrLot rangeOrLot = new RangeOrLot();
45+
46+
@CommandLine.Option(
47+
names = {"--name"},
48+
split = ",",
49+
description = "Filter results by the name of the arc."
50+
)
51+
List<String> names = new LinkedList<>();
52+
53+
@CommandLine.Option(
54+
names = {"--state"},
55+
split = ",",
56+
description = "Filter results by the state of the arc."
57+
)
58+
List<ArcState> states = new LinkedList<>();
59+
60+
@CommandLine.Option(
61+
names = {"--source"},
62+
split = ",",
63+
description = "Execute against this given source."
64+
)
65+
List<String> sources = new LinkedList<>();
66+
67+
public ArcExecCommandOptions setNames(List<String> names) {
68+
this.names = names;
69+
return this;
70+
}
71+
72+
public RangeOptions rangeOptions() {
73+
return rangeOrLot.rangeOptions;
74+
}
75+
76+
public Moment earliest() {
77+
return rangeOrLot.rangeOptions.earliest();
78+
}
79+
80+
public Moment latest() {
81+
return rangeOrLot.rangeOptions.latest();
82+
}
83+
84+
public ArcCommonOptions arcCommonOptions() {
85+
return arcCommonOptions;
86+
}
87+
88+
public ArcCommonOptions setProjects(List<String> projects) {
89+
return arcCommonOptions.setProjects(projects);
90+
}
91+
92+
public CommonOptions setProfile(String profile) {
93+
return arcCommonOptions.setProfile(profile);
94+
}
95+
96+
public CommonOptions setAccount(String account) {
97+
return arcCommonOptions.setAccount(account);
98+
}
99+
100+
public CommonOptions setRegion(String region) {
101+
return arcCommonOptions.setRegion(region);
102+
}
103+
104+
public CommonOptions setStage(String stage) {
105+
return arcCommonOptions.setStage(stage);
106+
}
107+
108+
public List<String> projects() {
109+
return arcCommonOptions.projects();
110+
}
111+
112+
public String profile() {
113+
return arcCommonOptions.profile();
114+
}
115+
116+
public String account() {
117+
return arcCommonOptions.account();
118+
}
119+
120+
public String region() {
121+
return arcCommonOptions.region();
122+
}
123+
124+
public String stage() {
125+
return arcCommonOptions.stage();
126+
}
127+
128+
public List<String> lots() {
129+
return rangeOrLot.lots;
130+
}
131+
132+
public List<String> names() {
133+
return names;
134+
}
135+
136+
public List<ArcState> states() {
137+
return states;
138+
}
139+
140+
public List<String> sources() {
141+
return sources;
142+
}
143+
}

0 commit comments

Comments
 (0)