@aws-sdk/client-appsync 3.511.0 → 3.513.0

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.
Files changed (50) hide show
  1. package/dist-cjs/auth/httpAuthExtensionConfiguration.js +1 -0
  2. package/dist-cjs/auth/httpAuthSchemeProvider.js +47 -0
  3. package/dist-cjs/index.js +109 -7
  4. package/dist-cjs/runtimeConfig.shared.js +10 -0
  5. package/dist-es/AppSyncClient.js +17 -4
  6. package/dist-es/auth/httpAuthExtensionConfiguration.js +38 -0
  7. package/dist-es/auth/httpAuthSchemeProvider.js +41 -0
  8. package/dist-es/models/models_0.js +24 -0
  9. package/dist-es/protocols/Aws_restJson1.js +8 -0
  10. package/dist-es/runtimeConfig.shared.js +10 -0
  11. package/dist-es/runtimeExtensions.js +3 -0
  12. package/dist-types/AppSyncClient.d.ts +13 -11
  13. package/dist-types/auth/httpAuthExtensionConfiguration.d.ts +29 -0
  14. package/dist-types/auth/httpAuthSchemeProvider.d.ts +61 -0
  15. package/dist-types/commands/CreateApiCacheCommand.d.ts +2 -0
  16. package/dist-types/commands/CreateDataSourceCommand.d.ts +2 -0
  17. package/dist-types/commands/CreateFunctionCommand.d.ts +4 -0
  18. package/dist-types/commands/CreateGraphqlApiCommand.d.ts +10 -0
  19. package/dist-types/commands/CreateResolverCommand.d.ts +2 -0
  20. package/dist-types/commands/DeleteFunctionCommand.d.ts +4 -0
  21. package/dist-types/commands/GetApiCacheCommand.d.ts +1 -0
  22. package/dist-types/commands/GetDataSourceCommand.d.ts +1 -0
  23. package/dist-types/commands/GetGraphqlApiCommand.d.ts +5 -0
  24. package/dist-types/commands/GetResolverCommand.d.ts +1 -0
  25. package/dist-types/commands/ListDataSourcesCommand.d.ts +1 -0
  26. package/dist-types/commands/ListGraphqlApisCommand.d.ts +5 -0
  27. package/dist-types/commands/ListResolversByFunctionCommand.d.ts +1 -0
  28. package/dist-types/commands/ListResolversCommand.d.ts +1 -0
  29. package/dist-types/commands/PutGraphqlApiEnvironmentVariablesCommand.d.ts +1 -1
  30. package/dist-types/commands/UpdateApiCacheCommand.d.ts +2 -0
  31. package/dist-types/commands/UpdateDataSourceCommand.d.ts +2 -0
  32. package/dist-types/commands/UpdateFunctionCommand.d.ts +4 -0
  33. package/dist-types/commands/UpdateGraphqlApiCommand.d.ts +10 -0
  34. package/dist-types/commands/UpdateResolverCommand.d.ts +2 -0
  35. package/dist-types/extensionConfiguration.d.ts +2 -1
  36. package/dist-types/models/models_0.d.ts +387 -1
  37. package/dist-types/runtimeConfig.browser.d.ts +5 -3
  38. package/dist-types/runtimeConfig.d.ts +4 -2
  39. package/dist-types/runtimeConfig.native.d.ts +6 -4
  40. package/dist-types/runtimeConfig.shared.d.ts +2 -0
  41. package/dist-types/ts3.4/AppSyncClient.d.ts +11 -9
  42. package/dist-types/ts3.4/auth/httpAuthExtensionConfiguration.d.ts +32 -0
  43. package/dist-types/ts3.4/auth/httpAuthSchemeProvider.d.ts +44 -0
  44. package/dist-types/ts3.4/extensionConfiguration.d.ts +3 -1
  45. package/dist-types/ts3.4/models/models_0.d.ts +53 -0
  46. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +5 -5
  47. package/dist-types/ts3.4/runtimeConfig.d.ts +4 -4
  48. package/dist-types/ts3.4/runtimeConfig.native.d.ts +8 -8
  49. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +2 -0
  50. package/package.json +7 -7
@@ -0,0 +1 @@
1
+ module.exports = require("../index.js");
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveHttpAuthSchemeConfig = exports.defaultAppSyncHttpAuthSchemeProvider = exports.defaultAppSyncHttpAuthSchemeParametersProvider = void 0;
4
+ const core_1 = require("@aws-sdk/core");
5
+ const util_middleware_1 = require("@smithy/util-middleware");
6
+ const defaultAppSyncHttpAuthSchemeParametersProvider = async (config, context, input) => {
7
+ return {
8
+ operation: (0, util_middleware_1.getSmithyContext)(context).operation,
9
+ region: (await (0, util_middleware_1.normalizeProvider)(config.region)()) ||
10
+ (() => {
11
+ throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
12
+ })(),
13
+ };
14
+ };
15
+ exports.defaultAppSyncHttpAuthSchemeParametersProvider = defaultAppSyncHttpAuthSchemeParametersProvider;
16
+ function createAwsAuthSigv4HttpAuthOption(authParameters) {
17
+ return {
18
+ schemeId: "aws.auth#sigv4",
19
+ signingProperties: {
20
+ name: "appsync",
21
+ region: authParameters.region,
22
+ },
23
+ propertiesExtractor: (config, context) => ({
24
+ signingProperties: {
25
+ config,
26
+ context,
27
+ },
28
+ }),
29
+ };
30
+ }
31
+ const defaultAppSyncHttpAuthSchemeProvider = (authParameters) => {
32
+ const options = [];
33
+ switch (authParameters.operation) {
34
+ default: {
35
+ options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
36
+ }
37
+ }
38
+ return options;
39
+ };
40
+ exports.defaultAppSyncHttpAuthSchemeProvider = defaultAppSyncHttpAuthSchemeProvider;
41
+ const resolveHttpAuthSchemeConfig = (config) => {
42
+ const config_0 = (0, core_1.resolveAwsSdkSigV4Config)(config);
43
+ return {
44
+ ...config_0,
45
+ };
46
+ };
47
+ exports.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig;
package/dist-cjs/index.js CHANGED
@@ -39,6 +39,7 @@ __export(src_exports, {
39
39
  AuthorizationType: () => AuthorizationType,
40
40
  BadRequestException: () => BadRequestException,
41
41
  BadRequestReason: () => BadRequestReason,
42
+ CacheHealthMetricsConfig: () => CacheHealthMetricsConfig,
42
43
  ConcurrentModificationException: () => ConcurrentModificationException,
43
44
  ConflictDetectionType: () => ConflictDetectionType,
44
45
  ConflictHandlerType: () => ConflictHandlerType,
@@ -51,6 +52,8 @@ __export(src_exports, {
51
52
  CreateResolverCommand: () => CreateResolverCommand,
52
53
  CreateTypeCommand: () => CreateTypeCommand,
53
54
  DataSourceIntrospectionStatus: () => DataSourceIntrospectionStatus,
55
+ DataSourceLevelMetricsBehavior: () => DataSourceLevelMetricsBehavior,
56
+ DataSourceLevelMetricsConfig: () => DataSourceLevelMetricsConfig,
54
57
  DataSourceType: () => DataSourceType,
55
58
  DefaultAction: () => DefaultAction,
56
59
  DeleteApiCacheCommand: () => DeleteApiCacheCommand,
@@ -100,11 +103,14 @@ __export(src_exports, {
100
103
  ListTypesCommand: () => ListTypesCommand,
101
104
  MergeType: () => MergeType,
102
105
  NotFoundException: () => NotFoundException,
106
+ OperationLevelMetricsConfig: () => OperationLevelMetricsConfig,
103
107
  OutputType: () => OutputType,
104
108
  Ownership: () => Ownership,
105
109
  PutGraphqlApiEnvironmentVariablesCommand: () => PutGraphqlApiEnvironmentVariablesCommand,
106
110
  RelationalDatabaseSourceType: () => RelationalDatabaseSourceType,
107
111
  ResolverKind: () => ResolverKind,
112
+ ResolverLevelMetricsBehavior: () => ResolverLevelMetricsBehavior,
113
+ ResolverLevelMetricsConfig: () => ResolverLevelMetricsConfig,
108
114
  RuntimeName: () => RuntimeName,
109
115
  SchemaStatus: () => SchemaStatus,
110
116
  SourceApiAssociationStatus: () => SourceApiAssociationStatus,
@@ -132,13 +138,14 @@ module.exports = __toCommonJS(src_exports);
132
138
  var import_middleware_host_header = require("@aws-sdk/middleware-host-header");
133
139
  var import_middleware_logger = require("@aws-sdk/middleware-logger");
134
140
  var import_middleware_recursion_detection = require("@aws-sdk/middleware-recursion-detection");
135
- var import_middleware_signing = require("@aws-sdk/middleware-signing");
136
141
  var import_middleware_user_agent = require("@aws-sdk/middleware-user-agent");
137
142
  var import_config_resolver = require("@smithy/config-resolver");
143
+ var import_core = require("@smithy/core");
138
144
  var import_middleware_content_length = require("@smithy/middleware-content-length");
139
145
  var import_middleware_endpoint = require("@smithy/middleware-endpoint");
140
146
  var import_middleware_retry = require("@smithy/middleware-retry");
141
147
 
148
+ var import_httpAuthSchemeProvider = require("./auth/httpAuthSchemeProvider");
142
149
 
143
150
  // src/endpoint/EndpointParameters.ts
144
151
  var resolveClientEndpointParameters = /* @__PURE__ */ __name((options) => {
@@ -163,19 +170,62 @@ var import_runtimeConfig = require("././runtimeConfig");
163
170
  var import_region_config_resolver = require("@aws-sdk/region-config-resolver");
164
171
  var import_protocol_http = require("@smithy/protocol-http");
165
172
  var import_smithy_client = require("@smithy/smithy-client");
173
+
174
+ // src/auth/httpAuthExtensionConfiguration.ts
175
+ var getHttpAuthExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => {
176
+ const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
177
+ let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
178
+ let _credentials = runtimeConfig.credentials;
179
+ return {
180
+ setHttpAuthScheme(httpAuthScheme) {
181
+ const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
182
+ if (index === -1) {
183
+ _httpAuthSchemes.push(httpAuthScheme);
184
+ } else {
185
+ _httpAuthSchemes.splice(index, 1, httpAuthScheme);
186
+ }
187
+ },
188
+ httpAuthSchemes() {
189
+ return _httpAuthSchemes;
190
+ },
191
+ setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
192
+ _httpAuthSchemeProvider = httpAuthSchemeProvider;
193
+ },
194
+ httpAuthSchemeProvider() {
195
+ return _httpAuthSchemeProvider;
196
+ },
197
+ setCredentials(credentials) {
198
+ _credentials = credentials;
199
+ },
200
+ credentials() {
201
+ return _credentials;
202
+ }
203
+ };
204
+ }, "getHttpAuthExtensionConfiguration");
205
+ var resolveHttpAuthRuntimeConfig = /* @__PURE__ */ __name((config) => {
206
+ return {
207
+ httpAuthSchemes: config.httpAuthSchemes(),
208
+ httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
209
+ credentials: config.credentials()
210
+ };
211
+ }, "resolveHttpAuthRuntimeConfig");
212
+
213
+ // src/runtimeExtensions.ts
166
214
  var asPartial = /* @__PURE__ */ __name((t) => t, "asPartial");
167
215
  var resolveRuntimeExtensions = /* @__PURE__ */ __name((runtimeConfig, extensions) => {
168
216
  const extensionConfiguration = {
169
217
  ...asPartial((0, import_region_config_resolver.getAwsRegionExtensionConfiguration)(runtimeConfig)),
170
218
  ...asPartial((0, import_smithy_client.getDefaultExtensionConfiguration)(runtimeConfig)),
171
- ...asPartial((0, import_protocol_http.getHttpHandlerExtensionConfiguration)(runtimeConfig))
219
+ ...asPartial((0, import_protocol_http.getHttpHandlerExtensionConfiguration)(runtimeConfig)),
220
+ ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig))
172
221
  };
173
222
  extensions.forEach((extension) => extension.configure(extensionConfiguration));
174
223
  return {
175
224
  ...runtimeConfig,
176
225
  ...(0, import_region_config_resolver.resolveAwsRegionExtensionConfiguration)(extensionConfiguration),
177
226
  ...(0, import_smithy_client.resolveDefaultRuntimeConfig)(extensionConfiguration),
178
- ...(0, import_protocol_http.resolveHttpHandlerRuntimeConfig)(extensionConfiguration)
227
+ ...(0, import_protocol_http.resolveHttpHandlerRuntimeConfig)(extensionConfiguration),
228
+ ...resolveHttpAuthRuntimeConfig(extensionConfiguration)
179
229
  };
180
230
  }, "resolveRuntimeExtensions");
181
231
 
@@ -188,8 +238,8 @@ var _AppSyncClient = class _AppSyncClient extends import_smithy_client.Client {
188
238
  const _config_3 = (0, import_middleware_endpoint.resolveEndpointConfig)(_config_2);
189
239
  const _config_4 = (0, import_middleware_retry.resolveRetryConfig)(_config_3);
190
240
  const _config_5 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_4);
191
- const _config_6 = (0, import_middleware_signing.resolveAwsAuthConfig)(_config_5);
192
- const _config_7 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_6);
241
+ const _config_6 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_5);
242
+ const _config_7 = (0, import_httpAuthSchemeProvider.resolveHttpAuthSchemeConfig)(_config_6);
193
243
  const _config_8 = resolveRuntimeExtensions(_config_7, (configuration == null ? void 0 : configuration.extensions) || []);
194
244
  super(_config_8);
195
245
  this.config = _config_8;
@@ -198,8 +248,14 @@ var _AppSyncClient = class _AppSyncClient extends import_smithy_client.Client {
198
248
  this.middlewareStack.use((0, import_middleware_host_header.getHostHeaderPlugin)(this.config));
199
249
  this.middlewareStack.use((0, import_middleware_logger.getLoggerPlugin)(this.config));
200
250
  this.middlewareStack.use((0, import_middleware_recursion_detection.getRecursionDetectionPlugin)(this.config));
201
- this.middlewareStack.use((0, import_middleware_signing.getAwsAuthPlugin)(this.config));
202
251
  this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config));
252
+ this.middlewareStack.use(
253
+ (0, import_core.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, {
254
+ httpAuthSchemeParametersProvider: this.getDefaultHttpAuthSchemeParametersProvider(),
255
+ identityProviderConfigProvider: this.getIdentityProviderConfigProvider()
256
+ })
257
+ );
258
+ this.middlewareStack.use((0, import_core.getHttpSigningPlugin)(this.config));
203
259
  }
204
260
  /**
205
261
  * Destroy underlying resources, like sockets. It's usually not necessary to do this.
@@ -209,6 +265,14 @@ var _AppSyncClient = class _AppSyncClient extends import_smithy_client.Client {
209
265
  destroy() {
210
266
  super.destroy();
211
267
  }
268
+ getDefaultHttpAuthSchemeParametersProvider() {
269
+ return import_httpAuthSchemeProvider.defaultAppSyncHttpAuthSchemeParametersProvider;
270
+ }
271
+ getIdentityProviderConfigProvider() {
272
+ return async (config) => new import_core.DefaultIdentityProviderConfig({
273
+ "aws.auth#sigv4": config.credentials
274
+ });
275
+ }
212
276
  };
213
277
  __name(_AppSyncClient, "AppSyncClient");
214
278
  var AppSyncClient = _AppSyncClient;
@@ -223,7 +287,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
223
287
  var import_types = require("@smithy/types");
224
288
 
225
289
  // src/protocols/Aws_restJson1.ts
226
- var import_core = require("@smithy/core");
290
+
227
291
 
228
292
 
229
293
  // src/models/AppSyncServiceException.ts
@@ -274,6 +338,10 @@ var ApiCachingBehavior = {
274
338
  FULL_REQUEST_CACHING: "FULL_REQUEST_CACHING",
275
339
  PER_RESOLVER_CACHING: "PER_RESOLVER_CACHING"
276
340
  };
341
+ var CacheHealthMetricsConfig = {
342
+ DISABLED: "DISABLED",
343
+ ENABLED: "ENABLED"
344
+ };
277
345
  var ApiCacheStatus = {
278
346
  AVAILABLE: "AVAILABLE",
279
347
  CREATING: "CREATING",
@@ -476,6 +544,10 @@ var UnauthorizedException = _UnauthorizedException;
476
544
  var AuthorizationType = {
477
545
  AWS_IAM: "AWS_IAM"
478
546
  };
547
+ var DataSourceLevelMetricsConfig = {
548
+ DISABLED: "DISABLED",
549
+ ENABLED: "ENABLED"
550
+ };
479
551
  var RelationalDatabaseSourceType = {
480
552
  RDS_HTTP_ENDPOINT: "RDS_HTTP_ENDPOINT"
481
553
  };
@@ -503,6 +575,18 @@ var GraphQLApiType = {
503
575
  GRAPHQL: "GRAPHQL",
504
576
  MERGED: "MERGED"
505
577
  };
578
+ var DataSourceLevelMetricsBehavior = {
579
+ FULL_REQUEST_DATA_SOURCE_METRICS: "FULL_REQUEST_DATA_SOURCE_METRICS",
580
+ PER_DATA_SOURCE_METRICS: "PER_DATA_SOURCE_METRICS"
581
+ };
582
+ var OperationLevelMetricsConfig = {
583
+ DISABLED: "DISABLED",
584
+ ENABLED: "ENABLED"
585
+ };
586
+ var ResolverLevelMetricsBehavior = {
587
+ FULL_REQUEST_RESOLVER_METRICS: "FULL_REQUEST_RESOLVER_METRICS",
588
+ PER_RESOLVER_METRICS: "PER_RESOLVER_METRICS"
589
+ };
506
590
  var GraphQLApiIntrospectionConfig = {
507
591
  DISABLED: "DISABLED",
508
592
  ENABLED: "ENABLED"
@@ -524,6 +608,10 @@ var ResolverKind = {
524
608
  PIPELINE: "PIPELINE",
525
609
  UNIT: "UNIT"
526
610
  };
611
+ var ResolverLevelMetricsConfig = {
612
+ DISABLED: "DISABLED",
613
+ ENABLED: "ENABLED"
614
+ };
527
615
  var TypeDefinitionFormat = {
528
616
  JSON: "JSON",
529
617
  SDL: "SDL"
@@ -632,6 +720,7 @@ var se_CreateApiCacheCommand = /* @__PURE__ */ __name(async (input, context) =>
632
720
  (0, import_smithy_client.take)(input, {
633
721
  apiCachingBehavior: [],
634
722
  atRestEncryptionEnabled: [],
723
+ healthMetricsConfig: [],
635
724
  transitEncryptionEnabled: [],
636
725
  ttl: [],
637
726
  type: []
@@ -673,6 +762,7 @@ var se_CreateDataSourceCommand = /* @__PURE__ */ __name(async (input, context) =
673
762
  eventBridgeConfig: (_) => (0, import_smithy_client._json)(_),
674
763
  httpConfig: (_) => (0, import_smithy_client._json)(_),
675
764
  lambdaConfig: (_) => (0, import_smithy_client._json)(_),
765
+ metricsConfig: [],
676
766
  name: [],
677
767
  openSearchServiceConfig: (_) => (0, import_smithy_client._json)(_),
678
768
  relationalDatabaseConfig: (_) => (0, import_smithy_client._json)(_),
@@ -737,6 +827,7 @@ var se_CreateGraphqlApiCommand = /* @__PURE__ */ __name(async (input, context) =
737
827
  additionalAuthenticationProviders: (_) => (0, import_smithy_client._json)(_),
738
828
  apiType: [],
739
829
  authenticationType: [],
830
+ enhancedMetricsConfig: (_) => (0, import_smithy_client._json)(_),
740
831
  introspectionConfig: [],
741
832
  lambdaAuthorizerConfig: (_) => (0, import_smithy_client._json)(_),
742
833
  logConfig: (_) => (0, import_smithy_client._json)(_),
@@ -772,6 +863,7 @@ var se_CreateResolverCommand = /* @__PURE__ */ __name(async (input, context) =>
772
863
  fieldName: [],
773
864
  kind: [],
774
865
  maxBatchSize: [],
866
+ metricsConfig: [],
775
867
  pipelineConfig: (_) => (0, import_smithy_client._json)(_),
776
868
  requestMappingTemplate: [],
777
869
  responseMappingTemplate: [],
@@ -1327,6 +1419,7 @@ var se_UpdateApiCacheCommand = /* @__PURE__ */ __name(async (input, context) =>
1327
1419
  body = JSON.stringify(
1328
1420
  (0, import_smithy_client.take)(input, {
1329
1421
  apiCachingBehavior: [],
1422
+ healthMetricsConfig: [],
1330
1423
  ttl: [],
1331
1424
  type: []
1332
1425
  })
@@ -1369,6 +1462,7 @@ var se_UpdateDataSourceCommand = /* @__PURE__ */ __name(async (input, context) =
1369
1462
  eventBridgeConfig: (_) => (0, import_smithy_client._json)(_),
1370
1463
  httpConfig: (_) => (0, import_smithy_client._json)(_),
1371
1464
  lambdaConfig: (_) => (0, import_smithy_client._json)(_),
1465
+ metricsConfig: [],
1372
1466
  openSearchServiceConfig: (_) => (0, import_smithy_client._json)(_),
1373
1467
  relationalDatabaseConfig: (_) => (0, import_smithy_client._json)(_),
1374
1468
  serviceRoleArn: [],
@@ -1432,6 +1526,7 @@ var se_UpdateGraphqlApiCommand = /* @__PURE__ */ __name(async (input, context) =
1432
1526
  (0, import_smithy_client.take)(input, {
1433
1527
  additionalAuthenticationProviders: (_) => (0, import_smithy_client._json)(_),
1434
1528
  authenticationType: [],
1529
+ enhancedMetricsConfig: (_) => (0, import_smithy_client._json)(_),
1435
1530
  introspectionConfig: [],
1436
1531
  lambdaAuthorizerConfig: (_) => (0, import_smithy_client._json)(_),
1437
1532
  logConfig: (_) => (0, import_smithy_client._json)(_),
@@ -1465,6 +1560,7 @@ var se_UpdateResolverCommand = /* @__PURE__ */ __name(async (input, context) =>
1465
1560
  dataSourceName: [],
1466
1561
  kind: [],
1467
1562
  maxBatchSize: [],
1563
+ metricsConfig: [],
1468
1564
  pipelineConfig: (_) => (0, import_smithy_client._json)(_),
1469
1565
  requestMappingTemplate: [],
1470
1566
  responseMappingTemplate: [],
@@ -3919,6 +4015,7 @@ var import_util_endpoints = require("@aws-sdk/util-endpoints");
3919
4015
  AuthenticationType,
3920
4016
  AssociationStatus,
3921
4017
  ApiCachingBehavior,
4018
+ CacheHealthMetricsConfig,
3922
4019
  ApiCacheStatus,
3923
4020
  ApiCacheType,
3924
4021
  ApiKeyLimitExceededException,
@@ -3935,16 +4032,21 @@ var import_util_endpoints = require("@aws-sdk/util-endpoints");
3935
4032
  LimitExceededException,
3936
4033
  UnauthorizedException,
3937
4034
  AuthorizationType,
4035
+ DataSourceLevelMetricsConfig,
3938
4036
  RelationalDatabaseSourceType,
3939
4037
  DataSourceType,
3940
4038
  ConflictDetectionType,
3941
4039
  ConflictHandlerType,
3942
4040
  GraphQLApiType,
4041
+ DataSourceLevelMetricsBehavior,
4042
+ OperationLevelMetricsConfig,
4043
+ ResolverLevelMetricsBehavior,
3943
4044
  GraphQLApiIntrospectionConfig,
3944
4045
  FieldLogLevel,
3945
4046
  DefaultAction,
3946
4047
  GraphQLApiVisibility,
3947
4048
  ResolverKind,
4049
+ ResolverLevelMetricsConfig,
3948
4050
  TypeDefinitionFormat,
3949
4051
  DataSourceIntrospectionStatus,
3950
4052
  OutputType,
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRuntimeConfig = void 0;
4
+ const core_1 = require("@aws-sdk/core");
4
5
  const smithy_client_1 = require("@smithy/smithy-client");
5
6
  const url_parser_1 = require("@smithy/url-parser");
6
7
  const util_base64_1 = require("@smithy/util-base64");
7
8
  const util_utf8_1 = require("@smithy/util-utf8");
9
+ const httpAuthSchemeProvider_1 = require("./auth/httpAuthSchemeProvider");
8
10
  const endpointResolver_1 = require("./endpoint/endpointResolver");
9
11
  const getRuntimeConfig = (config) => {
10
12
  return {
@@ -14,6 +16,14 @@ const getRuntimeConfig = (config) => {
14
16
  disableHostPrefix: config?.disableHostPrefix ?? false,
15
17
  endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver,
16
18
  extensions: config?.extensions ?? [],
19
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultAppSyncHttpAuthSchemeProvider,
20
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
21
+ {
22
+ schemeId: "aws.auth#sigv4",
23
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
24
+ signer: new core_1.AwsSdkSigV4Signer(),
25
+ },
26
+ ],
17
27
  logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
18
28
  serviceId: config?.serviceId ?? "AppSync",
19
29
  urlParser: config?.urlParser ?? url_parser_1.parseUrl,
@@ -1,13 +1,14 @@
1
1
  import { getHostHeaderPlugin, resolveHostHeaderConfig, } from "@aws-sdk/middleware-host-header";
2
2
  import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
3
3
  import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
4
- import { getAwsAuthPlugin, resolveAwsAuthConfig, } from "@aws-sdk/middleware-signing";
5
4
  import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
6
5
  import { resolveRegionConfig } from "@smithy/config-resolver";
6
+ import { DefaultIdentityProviderConfig, getHttpAuthSchemeEndpointRuleSetPlugin, getHttpSigningPlugin, } from "@smithy/core";
7
7
  import { getContentLengthPlugin } from "@smithy/middleware-content-length";
8
8
  import { resolveEndpointConfig } from "@smithy/middleware-endpoint";
9
9
  import { getRetryPlugin, resolveRetryConfig } from "@smithy/middleware-retry";
10
10
  import { Client as __Client, } from "@smithy/smithy-client";
11
+ import { defaultAppSyncHttpAuthSchemeParametersProvider, resolveHttpAuthSchemeConfig, } from "./auth/httpAuthSchemeProvider";
11
12
  import { resolveClientEndpointParameters, } from "./endpoint/EndpointParameters";
12
13
  import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
13
14
  import { resolveRuntimeExtensions } from "./runtimeExtensions";
@@ -20,8 +21,8 @@ export class AppSyncClient extends __Client {
20
21
  const _config_3 = resolveEndpointConfig(_config_2);
21
22
  const _config_4 = resolveRetryConfig(_config_3);
22
23
  const _config_5 = resolveHostHeaderConfig(_config_4);
23
- const _config_6 = resolveAwsAuthConfig(_config_5);
24
- const _config_7 = resolveUserAgentConfig(_config_6);
24
+ const _config_6 = resolveUserAgentConfig(_config_5);
25
+ const _config_7 = resolveHttpAuthSchemeConfig(_config_6);
25
26
  const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
26
27
  super(_config_8);
27
28
  this.config = _config_8;
@@ -30,10 +31,22 @@ export class AppSyncClient extends __Client {
30
31
  this.middlewareStack.use(getHostHeaderPlugin(this.config));
31
32
  this.middlewareStack.use(getLoggerPlugin(this.config));
32
33
  this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
33
- this.middlewareStack.use(getAwsAuthPlugin(this.config));
34
34
  this.middlewareStack.use(getUserAgentPlugin(this.config));
35
+ this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
36
+ httpAuthSchemeParametersProvider: this.getDefaultHttpAuthSchemeParametersProvider(),
37
+ identityProviderConfigProvider: this.getIdentityProviderConfigProvider(),
38
+ }));
39
+ this.middlewareStack.use(getHttpSigningPlugin(this.config));
35
40
  }
36
41
  destroy() {
37
42
  super.destroy();
38
43
  }
44
+ getDefaultHttpAuthSchemeParametersProvider() {
45
+ return defaultAppSyncHttpAuthSchemeParametersProvider;
46
+ }
47
+ getIdentityProviderConfigProvider() {
48
+ return async (config) => new DefaultIdentityProviderConfig({
49
+ "aws.auth#sigv4": config.credentials,
50
+ });
51
+ }
39
52
  }
@@ -0,0 +1,38 @@
1
+ export const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
2
+ const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
3
+ let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
4
+ let _credentials = runtimeConfig.credentials;
5
+ return {
6
+ setHttpAuthScheme(httpAuthScheme) {
7
+ const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
8
+ if (index === -1) {
9
+ _httpAuthSchemes.push(httpAuthScheme);
10
+ }
11
+ else {
12
+ _httpAuthSchemes.splice(index, 1, httpAuthScheme);
13
+ }
14
+ },
15
+ httpAuthSchemes() {
16
+ return _httpAuthSchemes;
17
+ },
18
+ setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
19
+ _httpAuthSchemeProvider = httpAuthSchemeProvider;
20
+ },
21
+ httpAuthSchemeProvider() {
22
+ return _httpAuthSchemeProvider;
23
+ },
24
+ setCredentials(credentials) {
25
+ _credentials = credentials;
26
+ },
27
+ credentials() {
28
+ return _credentials;
29
+ },
30
+ };
31
+ };
32
+ export const resolveHttpAuthRuntimeConfig = (config) => {
33
+ return {
34
+ httpAuthSchemes: config.httpAuthSchemes(),
35
+ httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
36
+ credentials: config.credentials(),
37
+ };
38
+ };
@@ -0,0 +1,41 @@
1
+ import { resolveAwsSdkSigV4Config, } from "@aws-sdk/core";
2
+ import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware";
3
+ export const defaultAppSyncHttpAuthSchemeParametersProvider = async (config, context, input) => {
4
+ return {
5
+ operation: getSmithyContext(context).operation,
6
+ region: (await normalizeProvider(config.region)()) ||
7
+ (() => {
8
+ throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
9
+ })(),
10
+ };
11
+ };
12
+ function createAwsAuthSigv4HttpAuthOption(authParameters) {
13
+ return {
14
+ schemeId: "aws.auth#sigv4",
15
+ signingProperties: {
16
+ name: "appsync",
17
+ region: authParameters.region,
18
+ },
19
+ propertiesExtractor: (config, context) => ({
20
+ signingProperties: {
21
+ config,
22
+ context,
23
+ },
24
+ }),
25
+ };
26
+ }
27
+ export const defaultAppSyncHttpAuthSchemeProvider = (authParameters) => {
28
+ const options = [];
29
+ switch (authParameters.operation) {
30
+ default: {
31
+ options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
32
+ }
33
+ }
34
+ return options;
35
+ };
36
+ export const resolveHttpAuthSchemeConfig = (config) => {
37
+ const config_0 = resolveAwsSdkSigV4Config(config);
38
+ return {
39
+ ...config_0,
40
+ };
41
+ };
@@ -27,6 +27,10 @@ export const ApiCachingBehavior = {
27
27
  FULL_REQUEST_CACHING: "FULL_REQUEST_CACHING",
28
28
  PER_RESOLVER_CACHING: "PER_RESOLVER_CACHING",
29
29
  };
30
+ export const CacheHealthMetricsConfig = {
31
+ DISABLED: "DISABLED",
32
+ ENABLED: "ENABLED",
33
+ };
30
34
  export const ApiCacheStatus = {
31
35
  AVAILABLE: "AVAILABLE",
32
36
  CREATING: "CREATING",
@@ -184,6 +188,10 @@ export class UnauthorizedException extends __BaseException {
184
188
  export const AuthorizationType = {
185
189
  AWS_IAM: "AWS_IAM",
186
190
  };
191
+ export const DataSourceLevelMetricsConfig = {
192
+ DISABLED: "DISABLED",
193
+ ENABLED: "ENABLED",
194
+ };
187
195
  export const RelationalDatabaseSourceType = {
188
196
  RDS_HTTP_ENDPOINT: "RDS_HTTP_ENDPOINT",
189
197
  };
@@ -211,6 +219,18 @@ export const GraphQLApiType = {
211
219
  GRAPHQL: "GRAPHQL",
212
220
  MERGED: "MERGED",
213
221
  };
222
+ export const DataSourceLevelMetricsBehavior = {
223
+ FULL_REQUEST_DATA_SOURCE_METRICS: "FULL_REQUEST_DATA_SOURCE_METRICS",
224
+ PER_DATA_SOURCE_METRICS: "PER_DATA_SOURCE_METRICS",
225
+ };
226
+ export const OperationLevelMetricsConfig = {
227
+ DISABLED: "DISABLED",
228
+ ENABLED: "ENABLED",
229
+ };
230
+ export const ResolverLevelMetricsBehavior = {
231
+ FULL_REQUEST_RESOLVER_METRICS: "FULL_REQUEST_RESOLVER_METRICS",
232
+ PER_RESOLVER_METRICS: "PER_RESOLVER_METRICS",
233
+ };
214
234
  export const GraphQLApiIntrospectionConfig = {
215
235
  DISABLED: "DISABLED",
216
236
  ENABLED: "ENABLED",
@@ -232,6 +252,10 @@ export const ResolverKind = {
232
252
  PIPELINE: "PIPELINE",
233
253
  UNIT: "UNIT",
234
254
  };
255
+ export const ResolverLevelMetricsConfig = {
256
+ DISABLED: "DISABLED",
257
+ ENABLED: "ENABLED",
258
+ };
235
259
  export const TypeDefinitionFormat = {
236
260
  JSON: "JSON",
237
261
  SDL: "SDL",
@@ -59,6 +59,7 @@ export const se_CreateApiCacheCommand = async (input, context) => {
59
59
  body = JSON.stringify(take(input, {
60
60
  apiCachingBehavior: [],
61
61
  atRestEncryptionEnabled: [],
62
+ healthMetricsConfig: [],
62
63
  transitEncryptionEnabled: [],
63
64
  ttl: [],
64
65
  type: [],
@@ -96,6 +97,7 @@ export const se_CreateDataSourceCommand = async (input, context) => {
96
97
  eventBridgeConfig: (_) => _json(_),
97
98
  httpConfig: (_) => _json(_),
98
99
  lambdaConfig: (_) => _json(_),
100
+ metricsConfig: [],
99
101
  name: [],
100
102
  openSearchServiceConfig: (_) => _json(_),
101
103
  relationalDatabaseConfig: (_) => _json(_),
@@ -154,6 +156,7 @@ export const se_CreateGraphqlApiCommand = async (input, context) => {
154
156
  additionalAuthenticationProviders: (_) => _json(_),
155
157
  apiType: [],
156
158
  authenticationType: [],
159
+ enhancedMetricsConfig: (_) => _json(_),
157
160
  introspectionConfig: [],
158
161
  lambdaAuthorizerConfig: (_) => _json(_),
159
162
  logConfig: (_) => _json(_),
@@ -187,6 +190,7 @@ export const se_CreateResolverCommand = async (input, context) => {
187
190
  fieldName: [],
188
191
  kind: [],
189
192
  maxBatchSize: [],
193
+ metricsConfig: [],
190
194
  pipelineConfig: (_) => _json(_),
191
195
  requestMappingTemplate: [],
192
196
  responseMappingTemplate: [],
@@ -726,6 +730,7 @@ export const se_UpdateApiCacheCommand = async (input, context) => {
726
730
  let body;
727
731
  body = JSON.stringify(take(input, {
728
732
  apiCachingBehavior: [],
733
+ healthMetricsConfig: [],
729
734
  ttl: [],
730
735
  type: [],
731
736
  }));
@@ -764,6 +769,7 @@ export const se_UpdateDataSourceCommand = async (input, context) => {
764
769
  eventBridgeConfig: (_) => _json(_),
765
770
  httpConfig: (_) => _json(_),
766
771
  lambdaConfig: (_) => _json(_),
772
+ metricsConfig: [],
767
773
  openSearchServiceConfig: (_) => _json(_),
768
774
  relationalDatabaseConfig: (_) => _json(_),
769
775
  serviceRoleArn: [],
@@ -821,6 +827,7 @@ export const se_UpdateGraphqlApiCommand = async (input, context) => {
821
827
  body = JSON.stringify(take(input, {
822
828
  additionalAuthenticationProviders: (_) => _json(_),
823
829
  authenticationType: [],
830
+ enhancedMetricsConfig: (_) => _json(_),
824
831
  introspectionConfig: [],
825
832
  lambdaAuthorizerConfig: (_) => _json(_),
826
833
  logConfig: (_) => _json(_),
@@ -852,6 +859,7 @@ export const se_UpdateResolverCommand = async (input, context) => {
852
859
  dataSourceName: [],
853
860
  kind: [],
854
861
  maxBatchSize: [],
862
+ metricsConfig: [],
855
863
  pipelineConfig: (_) => _json(_),
856
864
  requestMappingTemplate: [],
857
865
  responseMappingTemplate: [],
@@ -1,7 +1,9 @@
1
+ import { AwsSdkSigV4Signer } from "@aws-sdk/core";
1
2
  import { NoOpLogger } from "@smithy/smithy-client";
2
3
  import { parseUrl } from "@smithy/url-parser";
3
4
  import { fromBase64, toBase64 } from "@smithy/util-base64";
4
5
  import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
6
+ import { defaultAppSyncHttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider";
5
7
  import { defaultEndpointResolver } from "./endpoint/endpointResolver";
6
8
  export const getRuntimeConfig = (config) => {
7
9
  return {
@@ -11,6 +13,14 @@ export const getRuntimeConfig = (config) => {
11
13
  disableHostPrefix: config?.disableHostPrefix ?? false,
12
14
  endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
13
15
  extensions: config?.extensions ?? [],
16
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultAppSyncHttpAuthSchemeProvider,
17
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
18
+ {
19
+ schemeId: "aws.auth#sigv4",
20
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
21
+ signer: new AwsSdkSigV4Signer(),
22
+ },
23
+ ],
14
24
  logger: config?.logger ?? new NoOpLogger(),
15
25
  serviceId: config?.serviceId ?? "AppSync",
16
26
  urlParser: config?.urlParser ?? parseUrl,
@@ -1,12 +1,14 @@
1
1
  import { getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, } from "@aws-sdk/region-config-resolver";
2
2
  import { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig } from "@smithy/protocol-http";
3
3
  import { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig } from "@smithy/smithy-client";
4
+ import { getHttpAuthExtensionConfiguration, resolveHttpAuthRuntimeConfig } from "./auth/httpAuthExtensionConfiguration";
4
5
  const asPartial = (t) => t;
5
6
  export const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
6
7
  const extensionConfiguration = {
7
8
  ...asPartial(getAwsRegionExtensionConfiguration(runtimeConfig)),
8
9
  ...asPartial(getDefaultExtensionConfiguration(runtimeConfig)),
9
10
  ...asPartial(getHttpHandlerExtensionConfiguration(runtimeConfig)),
11
+ ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)),
10
12
  };
11
13
  extensions.forEach((extension) => extension.configure(extensionConfiguration));
12
14
  return {
@@ -14,5 +16,6 @@ export const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
14
16
  ...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
15
17
  ...resolveDefaultRuntimeConfig(extensionConfiguration),
16
18
  ...resolveHttpHandlerRuntimeConfig(extensionConfiguration),
19
+ ...resolveHttpAuthRuntimeConfig(extensionConfiguration),
17
20
  };
18
21
  };