diff --git a/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts b/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts index 3df162f8bb5c4..36a87436aa4d3 100644 --- a/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts +++ b/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts @@ -6,6 +6,11 @@ import { Construct, Duration, IResolvable } from "@aws-cdk/core"; import { readFileSync } from "fs"; import { CfnApiKey, CfnDataSource, CfnGraphQLApi, CfnGraphQLSchema, CfnResolver } from "./appsync.generated"; +/** + * Marker interface for the different authorization modes. + */ +export interface AuthMode { } + /** * enum with all possible values for Cognito user-pool default actions */ @@ -23,7 +28,7 @@ export enum UserPoolDefaultAction { /** * Configuration for Cognito user-pools in AppSync */ -export interface UserPoolConfig { +export interface UserPoolConfig extends AuthMode { /** * The Cognito user pool to use as identity source @@ -50,7 +55,7 @@ function isUserPoolConfig(obj: unknown): obj is UserPoolConfig { /** * Configuration for API Key authorization in AppSync */ -export interface ApiKeyConfig { +export interface ApiKeyConfig extends AuthMode { /** * Unique description of the API key */ @@ -69,11 +74,6 @@ function isApiKeyConfig(obj: unknown): obj is ApiKeyConfig { return (obj as ApiKeyConfig).apiKeyDesc !== undefined; } -/** - * Marker interface for the different authorization modes. - */ -type AuthMode = UserPoolConfig | ApiKeyConfig; - /** * Configuration of the API authorization modes. */ diff --git a/packages/@aws-cdk/aws-appsync/package.json b/packages/@aws-cdk/aws-appsync/package.json index feea1c3efc0d9..40bca04d8c6b6 100644 --- a/packages/@aws-cdk/aws-appsync/package.json +++ b/packages/@aws-cdk/aws-appsync/package.json @@ -103,5 +103,12 @@ "engines": { "node": ">= 10.3.0" }, + "awslint": { + "exclude": [ + "no-unused-type:@aws-cdk/aws-appsync.ApiKeyConfig", + "no-unused-type:@aws-cdk/aws-appsync.UserPoolConfig", + "no-unused-type:@aws-cdk/aws-appsync.UserPoolDefaultAction" + ] + }, "stability": "experimental" -} \ No newline at end of file +}