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.89.0 (build 2f74b3e)", date="2023-11-02T10:21:14.294Z") @Stability(Stable) public class GraphqlApi extends GraphqlApiBase
An AppSync GraphQL API.

Example:

 GraphqlApi sourceApi = GraphqlApi.Builder.create(this, "FirstSourceAPI")
         .name("FirstSourceAPI")
         .definition(Definition.fromFile(join(__dirname, "appsync.merged-api-1.graphql")))
         .build();
 IGraphqlApi importedMergedApi = GraphqlApi.fromGraphqlApiAttributes(this, "ImportedMergedApi", GraphqlApiAttributes.builder()
         .graphqlApiId("MyApiId")
         .graphqlApiArn("MyApiArn")
         .build());
 IRole importedExecutionRole = Role.fromRoleArn(this, "ExecutionRole", "arn:aws:iam::ACCOUNT:role/MyExistingRole");
 SourceApiAssociation.Builder.create(this, "SourceApiAssociation2")
         .sourceApi(sourceApi)
         .mergedApi(importedMergedApi)
         .mergeType(MergeType.MANUAL_MERGE)
         .mergedApiExecutionRole(importedExecutionRole)
         .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.
    • 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.
    • grant

      @Stability(Stable) @NotNull public Grant grant(@NotNull IGrantable grantee, @NotNull IamResource resources, @NotNull @NotNull String... actions)
      Adds an IAM policy statement associated with this GraphQLApi to an IAM principal's policy.

      Parameters:
      grantee - The principal. This parameter is required.
      resources - The set of resources to allow (i.e. ...:[region]:[accountId]:apis/GraphQLId/...). This parameter is required.
      actions - The actions that should be granted to the principal (i.e. appsync:graphql ). This parameter is required.
    • grantMutation

      @Stability(Stable) @NotNull public Grant grantMutation(@NotNull IGrantable grantee, @NotNull @NotNull String... fields)
      Adds an IAM policy statement for Mutation access to this GraphQLApi to an IAM principal's policy.

      Parameters:
      grantee - The principal. This parameter is required.
      fields - The fields to grant access to that are Mutations (leave blank for all). This parameter is required.
    • grantQuery

      @Stability(Stable) @NotNull public Grant grantQuery(@NotNull IGrantable grantee, @NotNull @NotNull String... fields)
      Adds an IAM policy statement for Query access to this GraphQLApi to an IAM principal's policy.

      Parameters:
      grantee - The principal. This parameter is required.
      fields - The fields to grant access to that are Queries (leave blank for all). This parameter is required.
    • grantSubscription

      @Stability(Stable) @NotNull public Grant grantSubscription(@NotNull IGrantable grantee, @NotNull @NotNull String... fields)
      Adds an IAM policy statement for Subscription access to this GraphQLApi to an IAM principal's policy.

      Parameters:
      grantee - The principal. This parameter is required.
      fields - The fields to grant access to that are Subscriptions (leave blank for all). 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
    • 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.
    • 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).
    • getApiKey

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

      Default: - no api key