@lambda-kata/cdk 0.1.3-rc.97 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/dist/index.js +40 -46
- package/out/tsc/src/index.d.ts +1 -3
- package/out/tsc/src/kata-wrapper.d.ts +1 -15
- package/out/tsc/src/types.d.ts +0 -6
- package/package.json +3 -2
- package/out/tsc/src/licensing.d.ts +0 -151
- package/out/tsc/src/mock-licensing.d.ts +0 -218
package/out/tsc/src/index.d.ts
CHANGED
|
@@ -18,11 +18,9 @@
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
export { KataProps, LicensingResponse, TransformationConfig } from './types';
|
|
21
|
-
export { LicensingService, LicenseCheckParams, HttpLicensingService, createLicensingService, isValidAccountId, } from './licensing';
|
|
22
|
-
export { MockLicensingService, createMockLicensingService, } from './mock-licensing';
|
|
23
21
|
export { resolveAccountId, resolveAccountIdWithSource, isValidAccountIdFormat, AccountResolutionError, AccountResolutionResult, AccountResolverOptions, } from './account-resolver';
|
|
24
22
|
export { resolveAccountIdSync, resolveAccountIdSyncWithSource, resolveRegionSync, SyncAccountResolutionError, SyncAccountResolutionResult, SyncAccountResolverOptions, } from './sync-account-resolver';
|
|
25
|
-
export { kata,
|
|
23
|
+
export { kata, applyTransformation, handleUnlicensed, isKataTransformed, getKataPromise, extractBundlePathFromHandler, extractNodeVersion, KataWrapperOptions, KataResult, } from './kata-wrapper';
|
|
26
24
|
export { SnapStartActivator, SnapStartActivatorProps, } from './snapstart-construct';
|
|
27
25
|
export { activateSnapStart, SnapStartActivationResult, SnapStartActivatorConfig, } from './snapstart-activator';
|
|
28
26
|
export { createKataConfigLayer, generateConfigContent, KataConfigLayerProps, CONFIG_DIR_NAME, CONFIG_FILE_NAME, HANDLER_CONFIG_KEY, } from './config-layer';
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import { Function as LambdaFunction } from 'aws-cdk-lib/aws-lambda';
|
|
2
2
|
import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';
|
|
3
3
|
import { KataProps, LicensingResponse, TransformationConfig } from './types';
|
|
4
|
-
import { LicensingService } from './licensing';
|
|
5
|
-
import { LicensingService as NativeLicensingServiceInterface } from '@lambda-kata/licensing';
|
|
6
4
|
/**
|
|
7
5
|
* Options for the kata wrapper, extending KataProps with internal options.
|
|
8
6
|
*/
|
|
9
7
|
export interface KataWrapperOptions extends KataProps {
|
|
10
|
-
/**
|
|
11
|
-
* Optional: Custom licensing service for testing.
|
|
12
|
-
* If not provided, the default HTTP licensing service will be used.
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
licensingService?: LicensingService;
|
|
16
|
-
/**
|
|
17
|
-
* Optional: Custom synchronous licensing service for testing.
|
|
18
|
-
* Must implement checkEntitlementSync(accountId: string): LicensingResponse
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
syncLicensingService?: NativeLicensingServiceInterface;
|
|
22
8
|
/**
|
|
23
9
|
* Custom bundle path.
|
|
24
10
|
* If not specified, uses the default /opt/js_runtime/bundle.js
|
|
@@ -224,7 +210,7 @@ export declare function applyTransformation(lambda: NodejsFunction | LambdaFunct
|
|
|
224
210
|
*
|
|
225
211
|
* @internal
|
|
226
212
|
*/
|
|
227
|
-
export declare function handleUnlicensed(lambda: NodejsFunction | LambdaFunction, props:
|
|
213
|
+
export declare function handleUnlicensed(lambda: NodejsFunction | LambdaFunction, props: KataProps | undefined, licensingResponse: LicensingResponse): void;
|
|
228
214
|
/**
|
|
229
215
|
* Checks if a Lambda function has been transformed by kata().
|
|
230
216
|
*
|
package/out/tsc/src/types.d.ts
CHANGED
|
@@ -12,16 +12,10 @@ import { Runtime } from 'aws-cdk-lib/aws-lambda';
|
|
|
12
12
|
* ```typescript
|
|
13
13
|
* kata(myFunction, {
|
|
14
14
|
* unlicensedBehavior: 'fail',
|
|
15
|
-
* licensingEndpoint: 'https://custom-endpoint.example.com'
|
|
16
15
|
* });
|
|
17
16
|
* ```
|
|
18
17
|
*/
|
|
19
18
|
export interface KataProps {
|
|
20
|
-
/**
|
|
21
|
-
* Optional: Override the licensing service endpoint
|
|
22
|
-
* Default: Lambda Kata production licensing endpoint
|
|
23
|
-
*/
|
|
24
|
-
licensingEndpoint?: string;
|
|
25
19
|
/**
|
|
26
20
|
* Optional: Behavior when account is not licensed
|
|
27
21
|
* 'warn' - Keep original Lambda, emit warning (default)
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lambda-kata/cdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "AWS CDK integration for Lambda Kata - Node.js Lambdas running via Lambda Kata runtime",
|
|
5
5
|
"main": "out/dist/index.js",
|
|
6
6
|
"types": "out/tsc/src/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "rm -rf ./dist && rm -rf ./out && rm -rf ./lib && yarn run build:cdk && yarn run build:snapstart && yarn run types",
|
|
9
|
+
"prepare": "yarn build",
|
|
9
10
|
"build:snapstart": "yarn run build:config && node dist/utils/build.js --target=snapstartHandler",
|
|
10
11
|
"types": "tsc --emitDeclarationOnly && tsc-alias",
|
|
11
12
|
"build:cdk": "yarn run build:config && node dist/utils/build.js --target=cdk",
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
"@aws-sdk/client-lambda": "^3.500.0",
|
|
59
60
|
"@aws-sdk/client-s3": "^3.500.0",
|
|
60
61
|
"@aws-sdk/client-sts": "^3.500.0",
|
|
61
|
-
"@lambda-kata/licensing": "0.1
|
|
62
|
+
"@lambda-kata/licensing": "0.2.1",
|
|
62
63
|
"dotenv": "^17.2.3",
|
|
63
64
|
"reflect-metadata": "^0.2.2"
|
|
64
65
|
},
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Licensing Service for Lambda Kata CDK Integration
|
|
3
|
-
*
|
|
4
|
-
* This module provides the interface and implementation for validating
|
|
5
|
-
* AWS Marketplace entitlements at CDK synthesis/deploy time.
|
|
6
|
-
*
|
|
7
|
-
* @module licensing
|
|
8
|
-
*/
|
|
9
|
-
import { LicensingResponse } from './types';
|
|
10
|
-
/**
|
|
11
|
-
* Supported Node.js versions for licensing requests.
|
|
12
|
-
* Valid values: "18", "20", "22", "24"
|
|
13
|
-
*/
|
|
14
|
-
export type NodeVersion = '18' | '20' | '22' | '24';
|
|
15
|
-
/**
|
|
16
|
-
* Supported architectures for licensing requests.
|
|
17
|
-
* Valid values: "x86_64", "arm64"
|
|
18
|
-
*/
|
|
19
|
-
export type LicenseArchitecture = 'x86_64' | 'arm64';
|
|
20
|
-
/**
|
|
21
|
-
* Parameters for license entitlement check.
|
|
22
|
-
*/
|
|
23
|
-
export interface LicenseCheckParams {
|
|
24
|
-
/**
|
|
25
|
-
* AWS account ID (12-digit string)
|
|
26
|
-
*/
|
|
27
|
-
accountId: string;
|
|
28
|
-
/**
|
|
29
|
-
* Node.js version number.
|
|
30
|
-
* Valid values: "18", "20", "22", "24"
|
|
31
|
-
* @default "20"
|
|
32
|
-
*/
|
|
33
|
-
nodeVersion?: NodeVersion;
|
|
34
|
-
/**
|
|
35
|
-
* Lambda architecture.
|
|
36
|
-
* Valid values: "x86_64", "arm64"
|
|
37
|
-
* @default "x86_64"
|
|
38
|
-
*/
|
|
39
|
-
architecture?: LicenseArchitecture;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Interface for the Lambda Kata licensing service.
|
|
43
|
-
*
|
|
44
|
-
* Implementations of this interface are responsible for validating
|
|
45
|
-
* AWS account entitlements and returning customer-specific Layer ARNs.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```typescript
|
|
49
|
-
* const licensingService = new HttpLicensingService();
|
|
50
|
-
* const response = await licensingService.checkEntitlement({
|
|
51
|
-
* accountId: '123456789012',
|
|
52
|
-
* nodeVersion: '20',
|
|
53
|
-
* architecture: 'x86_64'
|
|
54
|
-
* });
|
|
55
|
-
* if (response.entitled) {
|
|
56
|
-
* console.log(`Layer ARN: ${response.layerVersionArn}`);
|
|
57
|
-
* }
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export interface LicensingService {
|
|
61
|
-
/**
|
|
62
|
-
* Check if an AWS account is entitled to use Lambda Kata.
|
|
63
|
-
*
|
|
64
|
-
* @param params - License check parameters (accountId, nodeVersion, architecture)
|
|
65
|
-
* For backward compatibility, can also be just accountId string
|
|
66
|
-
* @returns Promise resolving to entitlement status and Layer ARN if entitled
|
|
67
|
-
*
|
|
68
|
-
* @remarks
|
|
69
|
-
* - If the account is entitled, the response will include the customer-specific Layer ARN
|
|
70
|
-
* - If the account is not entitled, the response will have `entitled: false`
|
|
71
|
-
* - Network errors are handled gracefully and treated as unlicensed (Requirement 6.5)
|
|
72
|
-
*/
|
|
73
|
-
checkEntitlement(params: LicenseCheckParams | string): Promise<LicensingResponse>;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* HTTP-based implementation of the LicensingService interface.
|
|
77
|
-
*
|
|
78
|
-
* This implementation calls the Lambda Kata licensing backend to validate
|
|
79
|
-
* AWS Marketplace entitlements. Network errors are handled gracefully
|
|
80
|
-
* by treating unreachable services as unlicensed (per Requirement 6.5).
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* ```typescript
|
|
84
|
-
* // Use default endpoint
|
|
85
|
-
* const service = new HttpLicensingService();
|
|
86
|
-
*
|
|
87
|
-
* // Use custom endpoint
|
|
88
|
-
* const customService = new HttpLicensingService('https://custom.endpoint.com');
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
export declare class HttpLicensingService implements LicensingService {
|
|
92
|
-
private readonly endpoint;
|
|
93
|
-
private readonly timeoutMs;
|
|
94
|
-
/**
|
|
95
|
-
* Creates a new HttpLicensingService instance.
|
|
96
|
-
*
|
|
97
|
-
* @param endpoint - Optional custom licensing endpoint URL
|
|
98
|
-
* @param timeoutMs - Optional request timeout in milliseconds (default: 5000)
|
|
99
|
-
*/
|
|
100
|
-
constructor(endpoint?: string, timeoutMs?: number);
|
|
101
|
-
/**
|
|
102
|
-
* Check if an AWS account is entitled to use Lambda Kata.
|
|
103
|
-
*
|
|
104
|
-
* Makes an HTTP request to the licensing service to validate the account's
|
|
105
|
-
* AWS Marketplace entitlement. If the service is unreachable or returns
|
|
106
|
-
* an error, the account is treated as unlicensed (Requirement 6.5).
|
|
107
|
-
*
|
|
108
|
-
* @param params - License check parameters or accountId string for backward compatibility
|
|
109
|
-
* @returns Promise resolving to entitlement status and Layer ARN if entitled
|
|
110
|
-
*
|
|
111
|
-
* @remarks
|
|
112
|
-
* Validates: Requirements 3.2, 3.3, 6.5
|
|
113
|
-
* - 3.2: Calls the Licensing_Service to validate the account's entitlement
|
|
114
|
-
* - 3.3: Returns the customer-specific Layer_ARN if entitled
|
|
115
|
-
* - 6.5: Treats unreachable service as unlicensed with appropriate warning
|
|
116
|
-
*/
|
|
117
|
-
checkEntitlement(params: LicenseCheckParams | string): Promise<LicensingResponse>;
|
|
118
|
-
/**
|
|
119
|
-
* Makes the HTTP request to the licensing service.
|
|
120
|
-
*
|
|
121
|
-
* @param accountId - The AWS account ID to check
|
|
122
|
-
* @param nodeVersion - Optional Node.js version (defaults to "20")
|
|
123
|
-
* @param architecture - Optional architecture (defaults to "x86_64")
|
|
124
|
-
* @returns Promise resolving to the licensing response
|
|
125
|
-
* @throws Error if the request fails or times out
|
|
126
|
-
*/
|
|
127
|
-
private makeRequest;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Validates that an AWS account ID is in the correct format.
|
|
131
|
-
*
|
|
132
|
-
* @param accountId - The account ID to validate
|
|
133
|
-
* @returns true if the account ID is a valid 12-digit string
|
|
134
|
-
*/
|
|
135
|
-
export declare function isValidAccountId(accountId: string): boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Creates a default LicensingService instance.
|
|
138
|
-
*
|
|
139
|
-
* This factory function provides a convenient way to create a licensing
|
|
140
|
-
* service with default configuration.
|
|
141
|
-
*
|
|
142
|
-
* @param endpoint - Optional custom licensing endpoint URL
|
|
143
|
-
* @returns A new LicensingService instance
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* ```typescript
|
|
147
|
-
* const service = createLicensingService();
|
|
148
|
-
* const response = await service.checkEntitlement('123456789012');
|
|
149
|
-
* ```
|
|
150
|
-
*/
|
|
151
|
-
export declare function createLicensingService(endpoint?: string): LicensingService;
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock Licensing Service for Lambda Kata CDK Integration Testing
|
|
3
|
-
*
|
|
4
|
-
* This module provides a mock implementation of the LicensingService interface
|
|
5
|
-
* for testing the kata() wrapper without making real network calls.
|
|
6
|
-
*
|
|
7
|
-
* @module mock-licensing
|
|
8
|
-
*/
|
|
9
|
-
import { LicensingService, LicenseCheckParams } from './licensing';
|
|
10
|
-
import { LicensingResponse } from './types';
|
|
11
|
-
/**
|
|
12
|
-
* Mock implementation of the LicensingService interface for testing.
|
|
13
|
-
*
|
|
14
|
-
* This class allows programmatic control over entitlement status,
|
|
15
|
-
* enabling comprehensive testing of the kata() wrapper behavior
|
|
16
|
-
* for both entitled and non-entitled accounts.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const mockService = new MockLicensingService();
|
|
21
|
-
*
|
|
22
|
-
* // Set up an entitled account
|
|
23
|
-
* mockService.setEntitled('123456789012', 'arn:aws:lambda:us-east-1:999999999999:layer:LambdaKata:1');
|
|
24
|
-
*
|
|
25
|
-
* // Check entitlement
|
|
26
|
-
* const response = await mockService.checkEntitlement('123456789012');
|
|
27
|
-
* console.log(response.entitled); // true
|
|
28
|
-
* console.log(response.layerArn); // 'arn:aws:lambda:us-east-1:999999999999:layer:LambdaKata:1'
|
|
29
|
-
*
|
|
30
|
-
* // Non-entitled account
|
|
31
|
-
* const response2 = await mockService.checkEntitlement('000000000000');
|
|
32
|
-
* console.log(response2.entitled); // false
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @remarks
|
|
36
|
-
* Validates: Requirements 3.2, 3.3
|
|
37
|
-
* - 3.2: Provides mock validation of account entitlements
|
|
38
|
-
* - 3.3: Returns customer-specific Layer_ARN for entitled accounts
|
|
39
|
-
*/
|
|
40
|
-
export declare class MockLicensingService implements LicensingService {
|
|
41
|
-
/**
|
|
42
|
-
* Map of AWS account IDs to their entitled Layer ARNs.
|
|
43
|
-
* Accounts not in this map are considered non-entitled.
|
|
44
|
-
*/
|
|
45
|
-
private entitlements;
|
|
46
|
-
/**
|
|
47
|
-
* Map of AWS account IDs to custom messages (for non-entitled accounts).
|
|
48
|
-
*/
|
|
49
|
-
private customMessages;
|
|
50
|
-
/**
|
|
51
|
-
* Optional custom message to return for entitled accounts.
|
|
52
|
-
*/
|
|
53
|
-
private entitledMessage;
|
|
54
|
-
/**
|
|
55
|
-
* Optional custom message to return for non-entitled accounts.
|
|
56
|
-
* Default matches the expected warning message from Requirement 6.4.
|
|
57
|
-
*/
|
|
58
|
-
private notEntitledMessage;
|
|
59
|
-
/**
|
|
60
|
-
* Optional expiration date for entitlements.
|
|
61
|
-
*/
|
|
62
|
-
private expiresAt?;
|
|
63
|
-
/**
|
|
64
|
-
* Flag to simulate service unavailability.
|
|
65
|
-
*/
|
|
66
|
-
private simulateServiceError;
|
|
67
|
-
/**
|
|
68
|
-
* Custom error message when simulating service errors.
|
|
69
|
-
*/
|
|
70
|
-
private serviceErrorMessage;
|
|
71
|
-
/**
|
|
72
|
-
* Flag to simulate entitled response without layerArn (service issue).
|
|
73
|
-
*/
|
|
74
|
-
private simulateEntitledWithoutLayerArn;
|
|
75
|
-
/**
|
|
76
|
-
* Sets an account as entitled with a specific Layer ARN.
|
|
77
|
-
*
|
|
78
|
-
* @param accountId - The AWS account ID (12-digit string)
|
|
79
|
-
* @param layerArn - The customer-specific Lambda Layer ARN
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```typescript
|
|
83
|
-
* mockService.setEntitled('123456789012', 'arn:aws:lambda:us-east-1:999999999999:layer:LambdaKata:1');
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
setEntitled(accountId: string, layerArn: string): void;
|
|
87
|
-
/**
|
|
88
|
-
* Removes entitlement for an account.
|
|
89
|
-
*
|
|
90
|
-
* @param accountId - The AWS account ID to remove entitlement for
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```typescript
|
|
94
|
-
* mockService.removeEntitlement('123456789012');
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
removeEntitlement(accountId: string): void;
|
|
98
|
-
/**
|
|
99
|
-
* Clears all entitlements.
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```typescript
|
|
103
|
-
* mockService.clearEntitlements();
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
clearEntitlements(): void;
|
|
107
|
-
/**
|
|
108
|
-
* Sets a custom message for entitled accounts.
|
|
109
|
-
*
|
|
110
|
-
* @param message - The message to return for entitled accounts
|
|
111
|
-
*/
|
|
112
|
-
setEntitledMessage(message: string): void;
|
|
113
|
-
/**
|
|
114
|
-
* Sets a custom message for non-entitled accounts.
|
|
115
|
-
*
|
|
116
|
-
* @param message - The message to return for non-entitled accounts
|
|
117
|
-
*/
|
|
118
|
-
setNotEntitledMessage(message: string): void;
|
|
119
|
-
/**
|
|
120
|
-
* Sets a custom message for a specific non-entitled account.
|
|
121
|
-
* This allows testing per-account custom error messages from the licensing service.
|
|
122
|
-
*
|
|
123
|
-
* @param accountId - The AWS account ID
|
|
124
|
-
* @param message - The custom message to return for this account
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```typescript
|
|
128
|
-
* mockService.setCustomMessage('123456789012', 'Custom licensing error: Account suspended');
|
|
129
|
-
* ```
|
|
130
|
-
*/
|
|
131
|
-
setCustomMessage(accountId: string, message: string): void;
|
|
132
|
-
/**
|
|
133
|
-
* Sets the expiration date for entitlements.
|
|
134
|
-
*
|
|
135
|
-
* @param expiresAt - ISO 8601 formatted expiration date
|
|
136
|
-
*/
|
|
137
|
-
setExpiresAt(expiresAt: string): void;
|
|
138
|
-
/**
|
|
139
|
-
* Configures the mock to simulate service unavailability.
|
|
140
|
-
*
|
|
141
|
-
* @param simulate - Whether to simulate service errors
|
|
142
|
-
* @param errorMessage - Optional custom error message
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
* ```typescript
|
|
146
|
-
* // Simulate service being down
|
|
147
|
-
* mockService.setSimulateServiceError(true);
|
|
148
|
-
*
|
|
149
|
-
* // With custom error message
|
|
150
|
-
* mockService.setSimulateServiceError(true, 'Connection refused');
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
setSimulateServiceError(simulate: boolean, errorMessage?: string): void;
|
|
154
|
-
/**
|
|
155
|
-
* Configures the mock to simulate entitled response without layerArn.
|
|
156
|
-
* This simulates a licensing service issue where the account is entitled
|
|
157
|
-
* but the service fails to return the layer ARN.
|
|
158
|
-
*
|
|
159
|
-
* @param simulate - Whether to simulate entitled without layerArn
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* ```typescript
|
|
163
|
-
* // Simulate service returning entitled: true but no layerArn
|
|
164
|
-
* mockService.setSimulateEntitledWithoutLayerArn(true);
|
|
165
|
-
* ```
|
|
166
|
-
*/
|
|
167
|
-
setSimulateEntitledWithoutLayerArn(simulate: boolean): void;
|
|
168
|
-
/**
|
|
169
|
-
* Check if an AWS account is entitled to use Lambda Kata.
|
|
170
|
-
*
|
|
171
|
-
* This mock implementation returns entitlement status based on
|
|
172
|
-
* accounts configured via setEntitled().
|
|
173
|
-
*
|
|
174
|
-
* @param params - License check parameters or accountId string for backward compatibility
|
|
175
|
-
* @returns Promise resolving to entitlement status and Layer ARN if entitled
|
|
176
|
-
*
|
|
177
|
-
* @remarks
|
|
178
|
-
* Validates: Requirements 3.2, 3.3
|
|
179
|
-
* - 3.2: Validates the account's entitlement based on configured entitlements
|
|
180
|
-
* - 3.3: Returns the customer-specific Layer_ARN if entitled
|
|
181
|
-
*/
|
|
182
|
-
checkEntitlement(params: LicenseCheckParams | string): Promise<LicensingResponse>;
|
|
183
|
-
/**
|
|
184
|
-
* Returns the number of entitled accounts.
|
|
185
|
-
*
|
|
186
|
-
* @returns The count of entitled accounts
|
|
187
|
-
*/
|
|
188
|
-
getEntitlementCount(): number;
|
|
189
|
-
/**
|
|
190
|
-
* Checks if a specific account is entitled (without async).
|
|
191
|
-
*
|
|
192
|
-
* @param accountId - The AWS account ID to check
|
|
193
|
-
* @returns true if the account is entitled
|
|
194
|
-
*/
|
|
195
|
-
isEntitled(accountId: string): boolean;
|
|
196
|
-
/**
|
|
197
|
-
* Gets the Layer ARN for an entitled account (without async).
|
|
198
|
-
*
|
|
199
|
-
* @param accountId - The AWS account ID
|
|
200
|
-
* @returns The Layer ARN if entitled, undefined otherwise
|
|
201
|
-
*/
|
|
202
|
-
getLayerArn(accountId: string): string | undefined;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Creates a MockLicensingService with pre-configured entitlements.
|
|
206
|
-
*
|
|
207
|
-
* @param entitlements - Map of account IDs to Layer ARNs
|
|
208
|
-
* @returns A new MockLicensingService instance with the specified entitlements
|
|
209
|
-
*
|
|
210
|
-
* @example
|
|
211
|
-
* ```typescript
|
|
212
|
-
* const mockService = createMockLicensingService({
|
|
213
|
-
* '123456789012': 'arn:aws:lambda:us-east-1:999999999999:layer:LambdaKata:1',
|
|
214
|
-
* '987654321098': 'arn:aws:lambda:us-west-2:999999999999:layer:LambdaKata:2',
|
|
215
|
-
* });
|
|
216
|
-
* ```
|
|
217
|
-
*/
|
|
218
|
-
export declare function createMockLicensingService(entitlements?: Record<string, string>): MockLicensingService;
|