File tree Expand file tree Collapse file tree 6 files changed +602
-5
lines changed
main/java/io/serverlessworkflow/fluent/spec
test/java/io/serverlessworkflow/fluent/spec/dsl Expand file tree Collapse file tree 6 files changed +602
-5
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,24 @@ public SELF use(Consumer<UseBuilder> useBuilderConsumer) {
7979 return self ();
8080 }
8181
82+ @ SafeVarargs
83+ public final SELF use (Consumer <UseBuilder >... configurers ) {
84+ if (configurers == null || configurers .length == 0 ) {
85+ return self ();
86+ }
87+ return use (List .of (configurers .clone ()));
88+ }
89+
90+ private SELF use (List <Consumer <UseBuilder >> configurers ) {
91+ final UseBuilder builder = new UseBuilder ();
92+ configurers .forEach (
93+ c -> {
94+ if (c != null ) c .accept (builder );
95+ });
96+ this .workflow .setUse (builder .build ());
97+ return self ();
98+ }
99+
82100 public SELF tasks (Consumer <DBuilder > doTaskConsumer ) {
83101 return appendDo (doTaskConsumer );
84102 }
Original file line number Diff line number Diff line change 1616package io .serverlessworkflow .fluent .spec ;
1717
1818import io .serverlessworkflow .api .types .Use ;
19+ import io .serverlessworkflow .api .types .UseAuthentications ;
1920import java .util .List ;
2021import java .util .function .Consumer ;
2122
@@ -25,6 +26,7 @@ public class UseBuilder {
2526
2627 UseBuilder () {
2728 this .use = new Use ();
29+ this .use .setAuthentications (new UseAuthentications ());
2830 }
2931
3032 public UseBuilder secrets (final String ... secrets ) {
@@ -37,7 +39,11 @@ public UseBuilder secrets(final String... secrets) {
3739 public UseBuilder authentications (Consumer <UseAuthenticationsBuilder > authenticationsConsumer ) {
3840 final UseAuthenticationsBuilder builder = new UseAuthenticationsBuilder ();
3941 authenticationsConsumer .accept (builder );
40- this .use .setAuthentications (builder .build ());
42+ final UseAuthentications useAuthentications = builder .build ();
43+ this .use
44+ .getAuthentications ()
45+ .getAdditionalProperties ()
46+ .putAll (useAuthentications .getAdditionalProperties ());
4147 return this ;
4248 }
4349
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2020-Present The Serverless Workflow Specification Authors
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package io .serverlessworkflow .fluent .spec .configurers ;
17+
18+ import io .serverlessworkflow .fluent .spec .UseBuilder ;
19+ import java .util .function .Consumer ;
20+
21+ @ FunctionalInterface
22+ public interface UseConfigurer extends Consumer <UseBuilder > {}
You can’t perform that action at this time.
0 commit comments