0
# AWS Rule Set Extension
1
2
The `AwsRuleSetExtension` is the main integration point for AWS-specific functionality in the Smithy rules engine. It provides AWS built-in parameters, library functions, and authentication validators.
3
4
## Capabilities
5
6
### AwsRuleSetExtension Class
7
8
The primary extension class that implements `EndpointRuleSetExtension` to integrate AWS-specific functionality into the Smithy rules engine.
9
10
```java { .api }
11
/**
12
* AWS-specific extensions to smithy-rules-engine.
13
*/
14
public final class AwsRuleSetExtension implements EndpointRuleSetExtension {
15
/**
16
* Returns the AWS-specific built-in parameters available to endpoint rules
17
* @return List of AWS built-in parameters including region, dual-stack, FIPS, etc.
18
*/
19
public List<Parameter> getBuiltIns();
20
21
/**
22
* Returns the AWS-specific library functions available to endpoint rules
23
* @return List of AWS library functions for partition resolution, ARN parsing, etc.
24
*/
25
public List<FunctionDefinition> getLibraryFunctions();
26
27
/**
28
* Returns the AWS-specific authentication scheme validators
29
* @return List of authentication validators for SigV4, SigV4a, etc.
30
*/
31
public List<AuthSchemeValidator> getAuthSchemeValidators();
32
}
33
```
34
35
### Service Registration
36
37
The extension is automatically registered through the Java Service Provider Interface:
38
39
```
40
META-INF/services/software.amazon.smithy.rulesengine.language.EndpointRuleSetExtension
41
```
42
43
**Usage Examples:**
44
45
```java
46
import software.amazon.smithy.rulesengine.aws.language.functions.AwsRuleSetExtension;
47
import software.amazon.smithy.rulesengine.language.EndpointRuleSetExtension;
48
49
// Extension is automatically loaded by the rules engine
50
// You typically don't instantiate this directly
51
EndpointRuleSetExtension extension = new AwsRuleSetExtension();
52
53
// Get AWS built-in parameters
54
List<Parameter> awsBuiltIns = extension.getBuiltIns();
55
// Includes: REGION, DUALSTACK, FIPS, ACCOUNT_ID, S3_ACCELERATE, etc.
56
57
// Get AWS library functions
58
List<FunctionDefinition> awsFunctions = extension.getLibraryFunctions();
59
// Includes: aws.partition, aws.parseArn, aws.isVirtualHostableS3Bucket
60
61
// Get authentication validators
62
List<AuthSchemeValidator> authValidators = extension.getAuthSchemeValidators();
63
// Includes validators for SigV4, SigV4a, SigV4 sub-schemes, and beta schemes
64
```
65
66
### Integration with Rules Engine
67
68
The extension integrates seamlessly with Smithy's rules engine to provide AWS-specific capabilities:
69
70
```java
71
// The rules engine automatically discovers and loads this extension
72
// Built-ins become available as parameters in endpoint rules
73
// Functions become available for use in rule expressions
74
// Validators ensure proper AWS authentication configuration
75
```
76
77
## Built-in Parameters Provided
78
79
The extension provides the following AWS-specific built-in parameters:
80
81
- `DUALSTACK` - UseDualStack boolean parameter
82
- `FIPS` - UseFIPS boolean parameter
83
- `REGION` - Region string parameter
84
- `ACCOUNT_ID` - AccountId string parameter
85
- `ACCOUNT_ID_ENDPOINT_MODE` - AccountIdEndpointMode string parameter
86
- `CREDENTIAL_SCOPE` - CredentialScope string parameter
87
- `S3_ACCELERATE` - S3 Accelerate boolean parameter
88
- `S3_DISABLE_MRAP` - S3 DisableMultiRegionAccessPoints boolean parameter
89
- `S3_FORCE_PATH_STYLE` - S3 ForcePathStyle boolean parameter
90
- `S3_USE_ARN_REGION` - S3 UseArnRegion boolean parameter
91
- `S3_USE_GLOBAL_ENDPOINT` - S3 UseGlobalEndpoint boolean parameter
92
- `S3_CONTROL_USE_ARN_REGION` - S3Control UseArnRegion boolean parameter
93
- `STS_USE_GLOBAL_ENDPOINT` - STS UseGlobalEndpoint boolean parameter
94
95
## Library Functions Provided
96
97
The extension provides these AWS-specific functions:
98
99
- `aws.partition` - Maps region to partition information
100
- `aws.parseArn` - Parses AWS ARN into component parts
101
- `aws.isVirtualHostableS3Bucket` - Validates S3 bucket for virtual hosting
102
103
## Authentication Validators Provided
104
105
The extension provides validators for AWS authentication schemes:
106
107
- `SigV4SchemeValidator` - Validates SigV4 authentication configuration
108
- `SigV4aSchemeValidator` - Validates SigV4a authentication configuration
109
- `SigV4SubSchemeValidator` - Validates SigV4 sub-scheme authentication
110
- `BetaSchemeValidator` - Validates beta authentication schemes