1
- /*
2
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
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
- * A copy of the License is located at
7
- *
8
- * http://aws.amazon.com/apache2.0
9
- *
10
- * or in the "license" file accompanying this file. This file is distributed
11
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
- * express or implied. See the License for the specific language governing
13
- * permissions and limitations under the License.
14
- */
15
-
16
1
package software .amazon .awssdk .services .query .endpoints .internal ;
17
2
18
3
import java .net .URI ;
@@ -31,7 +16,7 @@ public final class DefaultQueryEndpointProvider implements QueryEndpointProvider
31
16
@ Override
32
17
public CompletableFuture <Endpoint > resolveEndpoint (QueryEndpointParams params ) {
33
18
try {
34
- RuleResult result = endpointRule0 (params , new LocalState () );
19
+ RuleResult result = endpointRule0 (params );
35
20
if (result .canContinue ()) {
36
21
throw SdkClientException .create ("Rule engine did not reach an error or endpoint result" );
37
22
}
@@ -48,29 +33,21 @@ public CompletableFuture<Endpoint> resolveEndpoint(QueryEndpointParams params) {
48
33
}
49
34
}
50
35
51
- private static RuleResult endpointRule0 (QueryEndpointParams params , LocalState locals ) {
52
- RuleResult result = endpointRule1 (params , locals );
36
+ private static RuleResult endpointRule0 (QueryEndpointParams params ) {
37
+ RuleResult result = endpointRule1 (params );
53
38
if (result .isResolved ()) {
54
39
return result ;
55
40
}
56
- return endpointRule3 ( params , locals );
41
+ return RuleResult . error ( "Invalid Configuration: Missing Endpoint" );
57
42
}
58
43
59
- private static RuleResult endpointRule1 (QueryEndpointParams params , LocalState locals ) {
44
+ private static RuleResult endpointRule1 (QueryEndpointParams params ) {
60
45
if (params .endpoint () != null ) {
61
- return endpointRule2 ( params , locals );
46
+ return RuleResult . endpoint ( Endpoint . builder (). url ( URI . create ( params . endpoint ())). build () );
62
47
}
63
48
return RuleResult .carryOn ();
64
49
}
65
50
66
- private static RuleResult endpointRule2 (QueryEndpointParams params , LocalState locals ) {
67
- return RuleResult .endpoint (Endpoint .builder ().url (URI .create (params .endpoint ())).build ());
68
- }
69
-
70
- private static RuleResult endpointRule3 (QueryEndpointParams params , LocalState locals ) {
71
- return RuleResult .error ("Invalid Configuration: Missing Endpoint" );
72
- }
73
-
74
51
@ Override
75
52
public boolean equals (Object rhs ) {
76
53
return rhs != null && getClass ().equals (rhs .getClass ());
@@ -80,28 +57,4 @@ public boolean equals(Object rhs) {
80
57
public int hashCode () {
81
58
return getClass ().hashCode ();
82
59
}
83
-
84
- private static final class LocalState {
85
- LocalState () {
86
- }
87
-
88
- LocalState (LocalStateBuilder builder ) {
89
- }
90
-
91
- public LocalStateBuilder toBuilder () {
92
- return new LocalStateBuilder (this );
93
- }
94
- }
95
-
96
- private static final class LocalStateBuilder {
97
- LocalStateBuilder () {
98
- }
99
-
100
- LocalStateBuilder (LocalState locals ) {
101
- }
102
-
103
- LocalState build () {
104
- return new LocalState (this );
105
- }
106
- }
107
60
}
0 commit comments