Class GraphqlApi

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IGraphQLApiRef, IEnvironmentAware, IResource, IGraphqlApi, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.127.0 (build 2117ad5)", date="2026-03-27T13:11:54.288Z") @Stability(Stable) public class GraphqlApi extends GraphqlApiBase
An AppSync GraphQL API.

Example:

 SchemaFile schema = SchemaFile.Builder.create().filePath("mySchemaFile").build();
 GraphqlApi.Builder.create(this, "api")
         .name("myApi")
         .definition(Definition.fromSchema(schema))
         .enhancedMetricsConfig(EnhancedMetricsConfig.builder()
                 .dataSourceLevelMetricsBehavior(DataSourceLevelMetricsBehavior.FULL_REQUEST_DATA_SOURCE_METRICS)
                 .operationLevelMetricsConfig(OperationLevelMetricsConfig.ENABLED)
                 .resolverLevelMetricsBehavior(ResolverLevelMetricsBehavior.FULL_REQUEST_RESOLVER_METRICS)
                 .build())
         .build();
 
  • Field Details

    • PROPERTY_INJECTION_ID

      @Stability(Stable) public static final String PROPERTY_INJECTION_ID
      Uniquely identifies this class.
  • Constructor Details

    • GraphqlApi

      protected GraphqlApi(software.amazon.jsii.JsiiObjectRef objRef)
    • GraphqlApi

      protected GraphqlApi(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • GraphqlApi

      @Stability(Stable) public GraphqlApi(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GraphqlApiProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromGraphqlApiAttributes

      @Stability(Stable) @NotNull public static IGraphqlApi fromGraphqlApiAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GraphqlApiAttributes attrs)
      Import a GraphQL API through this function.

      Parameters:
      scope - scope. This parameter is required.
      id - id. This parameter is required.
      attrs - GraphQL API Attributes of an API. This parameter is required.
    • addEnvironmentVariable

      @Stability(Stable) public void addEnvironmentVariable(@NotNull String key, @NotNull String value)
      Add an environment variable to the construct.

      Parameters:
      key - This parameter is required.
      value - This parameter is required.
    • addSchemaDependency

      @Stability(Stable) @NotNull public Boolean addSchemaDependency(@NotNull CfnResource construct)
      Add schema dependency to a given construct.

      Specified by:
      addSchemaDependency in interface IGraphqlApi
      Overrides:
      addSchemaDependency in class GraphqlApiBase
      Parameters:
      construct - the dependee. This parameter is required.
    • getApiId

      @Stability(Stable) @NotNull public String getApiId()
      an unique AWS AppSync GraphQL API identifier i.e. 'lxz775lwdrgcndgz3nurvac7oa'.
      Specified by:
      getApiId in interface IGraphqlApi
      Specified by:
      getApiId in class GraphqlApiBase
    • getAppSyncDomainName

      @Stability(Stable) @NotNull public String getAppSyncDomainName()
      The AppSyncDomainName of the associated custom domain.
    • getArn

      @Stability(Stable) @NotNull public String getArn()
      the ARN of the API.
      Specified by:
      getArn in interface IGraphqlApi
      Specified by:
      getArn in class GraphqlApiBase
    • getGraphQLEndpointArn

      @Stability(Stable) @NotNull public String getGraphQLEndpointArn()
      The GraphQL endpoint ARN.
      Specified by:
      getGraphQLEndpointArn in interface IGraphqlApi
      Specified by:
      getGraphQLEndpointArn in class GraphqlApiBase
    • getGraphqlUrl

      @Stability(Stable) @NotNull public String getGraphqlUrl()
      the URL of the endpoint created by AppSync.
    • getLogGroup

      @Stability(Stable) @NotNull public ILogGroup getLogGroup()
      the CloudWatch Log Group for this API.
    • getModes

      @Stability(Stable) @NotNull public List<AuthorizationType> getModes()
      The Authorization Types for this GraphQL Api.
      Specified by:
      getModes in interface IGraphqlApi
      Specified by:
      getModes in class GraphqlApiBase
    • getName

      @Stability(Stable) @NotNull public String getName()
      the name of the API.
    • getSchema

      @Stability(Stable) @NotNull public ISchema getSchema()
      the schema attached to this api (only available for GraphQL APIs, not available for merged APIs).
    • getVisibility

      @Stability(Stable) @NotNull public Visibility getVisibility()
      the visibility of the API.
      Specified by:
      getVisibility in interface IGraphqlApi
      Specified by:
      getVisibility in class GraphqlApiBase
    • getApiKey

      @Stability(Stable) @Nullable public String getApiKey()
      the configured API key, if present.

      Default: - no api key