Class GraphqlApi

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

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-10-31T19:12:53.210Z") @Stability(Stable) public class GraphqlApi extends GraphqlApiBase
An AppSync GraphQL API.

Example:

 import software.amazon.awscdk.services.events.*;
 GraphqlApi api = GraphqlApi.Builder.create(this, "EventBridgeApi")
         .name("EventBridgeApi")
         .definition(Definition.fromFile(join(__dirname, "appsync.eventbridge.graphql")))
         .build();
 EventBus bus = EventBus.Builder.create(this, "DestinationEventBus").build();
 EventBridgeDataSource dataSource = api.addEventBridgeDataSource("NoneDS", bus);
 dataSource.createResolver("EventResolver", BaseResolverProps.builder()
         .typeName("Mutation")
         .fieldName("emitEvent")
         .requestMappingTemplate(MappingTemplate.fromFile("request.vtl"))
         .responseMappingTemplate(MappingTemplate.fromFile("response.vtl"))
         .build());
 
  • 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