createGraphqlApi method

Future<CreateGraphqlApiResponse> createGraphqlApi({
  1. required AuthenticationType authenticationType,
  2. required String name,
  3. List<AdditionalAuthenticationProvider>? additionalAuthenticationProviders,
  4. GraphQLApiType? apiType,
  5. EnhancedMetricsConfig? enhancedMetricsConfig,
  6. GraphQLApiIntrospectionConfig? introspectionConfig,
  7. LambdaAuthorizerConfig? lambdaAuthorizerConfig,
  8. LogConfig? logConfig,
  9. String? mergedApiExecutionRoleArn,
  10. OpenIDConnectConfig? openIDConnectConfig,
  11. String? ownerContact,
  12. int? queryDepthLimit,
  13. int? resolverCountLimit,
  14. Map<String, String>? tags,
  15. UserPoolConfig? userPoolConfig,
  16. GraphQLApiVisibility? visibility,
  17. bool? xrayEnabled,
})

Creates a GraphqlApi object.

May throw ApiLimitExceededException. May throw BadRequestException. May throw ConcurrentModificationException. May throw InternalFailureException. May throw LimitExceededException. May throw UnauthorizedException.

Parameter authenticationType : The authentication type: API key, Identity and Access Management (IAM), OpenID Connect (OIDC), Amazon Cognito user pools, or Lambda.

Parameter name : A user-supplied name for the GraphqlApi.

Parameter additionalAuthenticationProviders : A list of additional authentication providers for the GraphqlApi API.

Parameter apiType : The value that indicates whether the GraphQL API is a standard API (GRAPHQL) or merged API (MERGED).

Parameter enhancedMetricsConfig : The enhancedMetricsConfig object.

Parameter introspectionConfig : Sets the value of the GraphQL API to enable (ENABLED) or disable (DISABLED) introspection. If no value is provided, the introspection configuration will be set to ENABLED by default. This field will produce an error if the operation attempts to use the introspection feature while this field is disabled.

For more information about introspection, see GraphQL introspection.

Parameter lambdaAuthorizerConfig : Configuration for Lambda function authorization.

Parameter logConfig : The Amazon CloudWatch Logs configuration.

Parameter mergedApiExecutionRoleArn : The Identity and Access Management service role ARN for a merged API. The AppSync service assumes this role on behalf of the Merged API to validate access to source APIs at runtime and to prompt the AUTO_MERGE to update the merged API endpoint with the source API changes automatically.

Parameter openIDConnectConfig : The OIDC configuration.

Parameter ownerContact : The owner contact information for an API resource.

This field accepts any string input with a length of 0 - 256 characters.

Parameter queryDepthLimit : The maximum depth a query can have in a single request. Depth refers to the amount of nested levels allowed in the body of query. The default value is 0 (or unspecified), which indicates there's no depth limit. If you set a limit, it can be between 1 and 75 nested levels. This field will produce a limit error if the operation falls out of bounds.

Note that fields can still be set to nullable or non-nullable. If a non-nullable field produces an error, the error will be thrown upwards to the first nullable field available.

Parameter resolverCountLimit : The maximum number of resolvers that can be invoked in a single request. The default value is 0 (or unspecified), which will set the limit to 10000. When specified, the limit value can be between 1 and 10000. This field will produce a limit error if the operation falls out of bounds.

Parameter tags : A TagMap object.

Parameter userPoolConfig : The Amazon Cognito user pool configuration.

Parameter visibility : Sets the value of the GraphQL API to public (GLOBAL) or private (PRIVATE). If no value is provided, the visibility will be set to GLOBAL by default. This value cannot be changed once the API has been created.

Parameter xrayEnabled : A flag indicating whether to use X-Ray tracing for the GraphqlApi.

Implementation

Future<CreateGraphqlApiResponse> createGraphqlApi({
  required AuthenticationType authenticationType,
  required String name,
  List<AdditionalAuthenticationProvider>? additionalAuthenticationProviders,
  GraphQLApiType? apiType,
  EnhancedMetricsConfig? enhancedMetricsConfig,
  GraphQLApiIntrospectionConfig? introspectionConfig,
  LambdaAuthorizerConfig? lambdaAuthorizerConfig,
  LogConfig? logConfig,
  String? mergedApiExecutionRoleArn,
  OpenIDConnectConfig? openIDConnectConfig,
  String? ownerContact,
  int? queryDepthLimit,
  int? resolverCountLimit,
  Map<String, String>? tags,
  UserPoolConfig? userPoolConfig,
  GraphQLApiVisibility? visibility,
  bool? xrayEnabled,
}) async {
  _s.validateNumRange(
    'queryDepthLimit',
    queryDepthLimit,
    0,
    75,
  );
  _s.validateNumRange(
    'resolverCountLimit',
    resolverCountLimit,
    0,
    10000,
  );
  final $payload = <String, dynamic>{
    'authenticationType': authenticationType.value,
    'name': name,
    if (additionalAuthenticationProviders != null)
      'additionalAuthenticationProviders': additionalAuthenticationProviders,
    if (apiType != null) 'apiType': apiType.value,
    if (enhancedMetricsConfig != null)
      'enhancedMetricsConfig': enhancedMetricsConfig,
    if (introspectionConfig != null)
      'introspectionConfig': introspectionConfig.value,
    if (lambdaAuthorizerConfig != null)
      'lambdaAuthorizerConfig': lambdaAuthorizerConfig,
    if (logConfig != null) 'logConfig': logConfig,
    if (mergedApiExecutionRoleArn != null)
      'mergedApiExecutionRoleArn': mergedApiExecutionRoleArn,
    if (openIDConnectConfig != null)
      'openIDConnectConfig': openIDConnectConfig,
    if (ownerContact != null) 'ownerContact': ownerContact,
    if (queryDepthLimit != null) 'queryDepthLimit': queryDepthLimit,
    if (resolverCountLimit != null) 'resolverCountLimit': resolverCountLimit,
    if (tags != null) 'tags': tags,
    if (userPoolConfig != null) 'userPoolConfig': userPoolConfig,
    if (visibility != null) 'visibility': visibility.value,
    if (xrayEnabled != null) 'xrayEnabled': xrayEnabled,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/apis',
    exceptionFnMap: _exceptionFns,
  );
  return CreateGraphqlApiResponse.fromJson(response);
}