Skip to content

create_graphql_api

create_graphql_api(
    name: String,
    authentication_type: AuthenticationType,
    *,
    config_overrides: Optional[AppSyncClientConfig] = None,
    log_config: Optional[LogConfig] = None,
    user_pool_config: Optional[UserPoolConfig] = None,
    open_id_connect_config: Optional[OpenIDConnectConfig] = None,
    tags: Optional[TagMap] = None,
    additional_authentication_providers: Optional[
        AdditionalAuthenticationProviders
    ] = None,
    xray_enabled: Optional[Boolean] = None,
    lambda_authorizer_config: Optional[LambdaAuthorizerConfig] = None,
    api_type: Optional[GraphQLApiType] = None,
    merged_api_execution_role_arn: Optional[String] = None,
    visibility: Optional[GraphQLApiVisibility] = None,
    owner_contact: Optional[String] = None,
    introspection_config: Optional[GraphQLApiIntrospectionConfig] = None,
    query_depth_limit: Optional[QueryDepthLimit] = None,
    resolver_count_limit: Optional[ResolverCountLimit] = None,
    enhanced_metrics_config: Optional[EnhancedMetricsConfig] = None,
) -> CreateGraphqlApiResponse

Creates a GraphqlApi object.

Parameters:

  • name (String) –

    A user-supplied name for the GraphqlApi.

  • log_config (Optional[LogConfig], default: None ) –

    The Amazon CloudWatch Logs configuration.

  • authentication_type (AuthenticationType) –

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

  • user_pool_config (Optional[UserPoolConfig], default: None ) –

    The Amazon Cognito user pool configuration.

  • open_id_connect_config (Optional[OpenIDConnectConfig], default: None ) –

    The OIDC configuration.

  • tags (Optional[TagMap], default: None ) –

    A TagMap object.

  • additional_authentication_providers (Optional[AdditionalAuthenticationProviders], default: None ) –

    A list of additional authentication providers for the GraphqlApi API.

  • xray_enabled (Optional[Boolean], default: None ) –

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

  • lambda_authorizer_config (Optional[LambdaAuthorizerConfig], default: None ) –

    Configuration for Lambda function authorization.

  • api_type (Optional[GraphQLApiType], default: None ) –

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

  • merged_api_execution_role_arn (Optional[String], default: None ) –

    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.

  • visibility (Optional[GraphQLApiVisibility], default: None ) –

    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.

  • owner_contact (Optional[String], default: None ) –

    The owner contact information for an API resource.

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

  • introspection_config (Optional[GraphQLApiIntrospectionConfig], default: None ) –

    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.

  • query_depth_limit (Optional[QueryDepthLimit], default: None ) –

    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.

  • resolver_count_limit (Optional[ResolverCountLimit], default: None ) –

    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.

  • enhanced_metrics_config (Optional[EnhancedMetricsConfig], default: None ) –

    The enhancedMetricsConfig object.

Raises:

Source code in docs_src/capo_appsync/_services/app_sync.py
def create_graphql_api(
    self,
    name: "capo_appsync.types.string.String",
    authentication_type: "capo_appsync.types.authentication_type.AuthenticationType",
    *,
    config_overrides: Optional[AppSyncClientConfig] = None,
    log_config: Optional["capo_appsync.types.log_config.LogConfig"] = None,
    user_pool_config: Optional[
        "capo_appsync.types.user_pool_config.UserPoolConfig"
    ] = None,
    open_id_connect_config: Optional[
        "capo_appsync.types.open_id_connect_config.OpenIDConnectConfig"
    ] = None,
    tags: Optional["capo_appsync.types.tag_map.TagMap"] = None,
    additional_authentication_providers: Optional[
        "capo_appsync.types.additional_authentication_providers.AdditionalAuthenticationProviders"
    ] = None,
    xray_enabled: Optional["capo_appsync.types.boolean.Boolean"] = None,
    lambda_authorizer_config: Optional[
        "capo_appsync.types.lambda_authorizer_config.LambdaAuthorizerConfig"
    ] = None,
    api_type: Optional[
        "capo_appsync.types.graph_ql_api_type.GraphQLApiType"
    ] = None,
    merged_api_execution_role_arn: Optional[
        "capo_appsync.types.string.String"
    ] = None,
    visibility: Optional[
        "capo_appsync.types.graph_ql_api_visibility.GraphQLApiVisibility"
    ] = None,
    owner_contact: Optional["capo_appsync.types.string.String"] = None,
    introspection_config: Optional[
        "capo_appsync.types.graph_ql_api_introspection_config.GraphQLApiIntrospectionConfig"
    ] = None,
    query_depth_limit: Optional[
        "capo_appsync.types.query_depth_limit.QueryDepthLimit"
    ] = None,
    resolver_count_limit: Optional[
        "capo_appsync.types.resolver_count_limit.ResolverCountLimit"
    ] = None,
    enhanced_metrics_config: Optional[
        "capo_appsync.types.enhanced_metrics_config.EnhancedMetricsConfig"
    ] = None,
) -> "capo_appsync.types.create_graphql_api_response.CreateGraphqlApiResponse":
    """<p>Creates a <code>GraphqlApi</code> object.</p>

    Args:
        name: <p>A user-supplied name for the <code>GraphqlApi</code>.</p>
        log_config: <p>The Amazon CloudWatch Logs configuration.</p>
        authentication_type: <p>The authentication type: API key, Identity and Access Management (IAM), OpenID Connect (OIDC), Amazon Cognito user pools, or Lambda.</p>
        user_pool_config: <p>The Amazon Cognito user pool configuration.</p>
        open_id_connect_config: <p>The OIDC configuration.</p>
        tags: <p>A <code>TagMap</code> object.</p>
        additional_authentication_providers: <p>A list of additional authentication providers for the <code>GraphqlApi</code> API.</p>
        xray_enabled: <p>A flag indicating whether to use X-Ray tracing for the <code>GraphqlApi</code>.</p>
        lambda_authorizer_config: <p>Configuration for Lambda function authorization.</p>
        api_type: <p>The value that indicates whether the GraphQL API is a standard API (<code>GRAPHQL</code>) or merged API (<code>MERGED</code>).</p>
        merged_api_execution_role_arn: <p>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 <code>AUTO_MERGE</code> to update the merged API endpoint with the source API changes automatically.</p>
        visibility: <p>Sets the value of the GraphQL API to public (<code>GLOBAL</code>) or private (<code>PRIVATE</code>). If no value is provided, the visibility will be set to <code>GLOBAL</code> by default. This value cannot be changed once the API has been created.</p>
        owner_contact: <p>The owner contact information for an API resource.</p> <p>This field accepts any string input with a length of 0 - 256 characters.</p>
        introspection_config: <p>Sets the value of the GraphQL API to enable (<code>ENABLED</code>) or disable (<code>DISABLED</code>) introspection. If no value is provided, the introspection configuration will be set to <code>ENABLED</code> by default. This field will produce an error if the operation attempts to use the introspection feature while this field is disabled.</p> <p>For more information about introspection, see <a href="https://graphql.org/learn/introspection/">GraphQL introspection</a>.</p>
        query_depth_limit: <p>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 <code>0</code> (or unspecified), which indicates there's no depth limit. If you set a limit, it can be between <code>1</code> and <code>75</code> nested levels. This field will produce a limit error if the operation falls out of bounds.</p> <p>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.</p>
        resolver_count_limit: <p>The maximum number of resolvers that can be invoked in a single request. The default value is <code>0</code> (or unspecified), which will set the limit to <code>10000</code>. When specified, the limit value can be between <code>1</code> and <code>10000</code>. This field will produce a limit error if the operation falls out of bounds.</p>
        enhanced_metrics_config: <p>The <code>enhancedMetricsConfig</code> object.</p>

    Raises:
        capo_appsync.errors.api_limit_exceeded_exception.ApiLimitExceededException: <p>The GraphQL API exceeded a limit. Try your request again.</p>
        capo_appsync.errors.bad_request_exception.BadRequestException: <p>The request is not well formed. For example, a value is invalid or a required field is missing. Check the field values, and then try again.</p>
        capo_appsync.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Another modification is in progress at this time and it must complete before you can make your change.</p>
        capo_appsync.errors.internal_failure_exception.InternalFailureException: <p>An internal AppSync error occurred. Try your request again.</p>
        capo_appsync.errors.limit_exceeded_exception.LimitExceededException: <p>The request exceeded a limit. Try your request again.</p>
        capo_appsync.errors.unauthorized_exception.UnauthorizedException: <p>You aren't authorized to perform this operation.</p>
        capo_appsync.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_appsync.types.create_graphql_api_request.CreateGraphqlApiRequest]",
    ) -> OperationResponse[
        "capo_appsync.types.create_graphql_api_response.CreateGraphqlApiResponse"
    ]:
        import capo_appsync._operations.aws_deepdish_control_plane_service.create_graphql_api

        output, http_response = (
            capo_appsync._operations.aws_deepdish_control_plane_service.create_graphql_api.create_graphql_api(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateGraphqlApi")
    )
    input_: capo_appsync.types.create_graphql_api_request.CreateGraphqlApiRequest = {
        "name": name,
        "authentication_type": authentication_type,
    }
    if log_config is not None:
        input_["log_config"] = log_config
    if user_pool_config is not None:
        input_["user_pool_config"] = user_pool_config
    if open_id_connect_config is not None:
        input_["open_id_connect_config"] = open_id_connect_config
    if tags is not None:
        input_["tags"] = tags
    if additional_authentication_providers is not None:
        input_["additional_authentication_providers"] = (
            additional_authentication_providers
        )
    if xray_enabled is not None:
        input_["xray_enabled"] = xray_enabled
    if lambda_authorizer_config is not None:
        input_["lambda_authorizer_config"] = lambda_authorizer_config
    if api_type is not None:
        input_["api_type"] = api_type
    if merged_api_execution_role_arn is not None:
        input_["merged_api_execution_role_arn"] = merged_api_execution_role_arn
    if visibility is not None:
        input_["visibility"] = visibility
    if owner_contact is not None:
        input_["owner_contact"] = owner_contact
    if introspection_config is not None:
        input_["introspection_config"] = introspection_config
    if query_depth_limit is not None:
        input_["query_depth_limit"] = query_depth_limit
    if resolver_count_limit is not None:
        input_["resolver_count_limit"] = resolver_count_limit
    if enhanced_metrics_config is not None:
        input_["enhanced_metrics_config"] = enhanced_metrics_config

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output