diff --git a/src/resources/Api.ts b/src/resources/Api.ts index 04e5d7af..6da7433b 100644 --- a/src/resources/Api.ts +++ b/src/resources/Api.ts @@ -114,10 +114,13 @@ export class Api { if (this.config.enhancedMetrics) { merge(endpointResource.Properties, { - EnhancedMetricsConfig: { - "DataSourceLevelMetricsBehavior" : this.config.enhancedMetrics.DataSourceLevelMetricsBehavior, - "OperationLevelMetricsConfig" : this.config.enhancedMetrics.OperationLevelMetricsConfig, - "ResolverLevelMetricsBehavior": "PER_RESOLVER_METRICS" } + EnhancedMetricsConfig: { + DataSourceLevelMetricsBehavior: + this.config.enhancedMetrics.DataSourceLevelMetricsBehavior, + OperationLevelMetricsConfig: + this.config.enhancedMetrics.OperationLevelMetricsConfig, + ResolverLevelMetricsBehavior: 'PER_RESOLVER_METRICS', + }, }); } diff --git a/src/resources/Resolver.ts b/src/resources/Resolver.ts index bf432438..09027738 100644 --- a/src/resources/Resolver.ts +++ b/src/resources/Resolver.ts @@ -29,7 +29,7 @@ export class Resolver { ApiId: this.api.getApiId(), TypeName: this.config.type, FieldName: this.config.field, - MetricsConfig: 'DISABLED' + MetricsConfig: 'DISABLED', }; const isVTLResolver = 'request' in this.config || 'response' in this.config; diff --git a/src/types/cloudFormation.ts b/src/types/cloudFormation.ts index a0d211cf..a52572cf 100644 --- a/src/types/cloudFormation.ts +++ b/src/types/cloudFormation.ts @@ -117,7 +117,7 @@ export type CfnResolver = { }; }; MaxBatchSize?: number; - MetricsConfig? : 'ENABLED' | 'DISABLED'; + MetricsConfig?: 'ENABLED' | 'DISABLED'; }; }; diff --git a/src/types/common.ts b/src/types/common.ts index 4490438d..20660c78 100644 --- a/src/types/common.ts +++ b/src/types/common.ts @@ -131,9 +131,13 @@ export type SyncConfig = { export type Substitutions = Record; export type EnvironmentVariables = Record; export type EnhancedMetricsConfig = { - "DataSourceLevelMetricsBehavior" : 'FULL_REQUEST_DATA_SOURCE_METRICS'| 'PER_DATA_SOURCE_METRICS'; - "OperationLevelMetricsConfig" : 'ENABLED' | ' DISABLED'; - "ResolverLevelMetricsBehavior" : 'FULL_REQUEST_RESOLVER_METRICS' | 'PER_RESOLVER_METRICS' ; + DataSourceLevelMetricsBehavior: + | 'FULL_REQUEST_DATA_SOURCE_METRICS' + | 'PER_DATA_SOURCE_METRICS'; + OperationLevelMetricsConfig: 'ENABLED' | ' DISABLED'; + ResolverLevelMetricsBehavior: + | 'FULL_REQUEST_RESOLVER_METRICS' + | 'PER_RESOLVER_METRICS'; }; export type DsDynamoDBConfig = { diff --git a/src/types/plugin.ts b/src/types/plugin.ts index e0767401..4d04d5a3 100644 --- a/src/types/plugin.ts +++ b/src/types/plugin.ts @@ -16,7 +16,7 @@ import { DsNone, Substitutions, EnvironmentVariables, - EnhancedMetricsConfig + EnhancedMetricsConfig, } from './common'; export * from './common'; diff --git a/src/validation.ts b/src/validation.ts index 05c1d9e5..1cbe5959 100644 --- a/src/validation.ts +++ b/src/validation.ts @@ -816,14 +816,15 @@ export const appSyncSchema = { DataSourceLevelMetricsBehavior: { type: 'string', enum: ['FULL_REQUEST_DATA_SOURCE_METRICS', 'PER_DATA_SOURCE_METRICS'], - errorMessage: "must be 'FULL_REQUEST_DATA_SOURCE_METRICS' or 'PER_DATA_SOURCE_METRICS'", + errorMessage: + "must be 'FULL_REQUEST_DATA_SOURCE_METRICS' or 'PER_DATA_SOURCE_METRICS'", }, OperationLevelMetricsConfig: { type: 'string', enum: ['ENABLED', ' DISABLED'], errorMessage: "must be 'ENABLED' or ' DISABLED'", }, - } + }, }, dataSources: { oneOf: [