Class GraphqlApi

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

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:49.502Z") @Stability(Experimental) public class GraphqlApi extends GraphqlApiBase
(experimental) An AppSync GraphQL API.

Example:

 GraphqlApi api = GraphqlApi.Builder.create(this, "Api")
         .name("demo")
         .build();
 ObjectType demo = ObjectType.Builder.create("Demo")
         .definition(Map.of(
                 "id", GraphqlType.string(BaseTypeOptions.builder().isRequired(true).build()),
                 "version", GraphqlType.string(BaseTypeOptions.builder().isRequired(true).build())))
         .build();
 api.addType(demo);
 
  • Constructor Details

    • GraphqlApi

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

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

      @Stability(Experimental) 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(Experimental) @NotNull public static IGraphqlApi fromGraphqlApiAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GraphqlApiAttributes attrs)
      (experimental) 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.
    • addMutation

      @Stability(Experimental) @NotNull public ObjectType addMutation(@NotNull String fieldName, @NotNull ResolvableField field)
      (experimental) Add a mutation field to the schema's Mutation. CDK will create an Object Type called 'Mutation'. For example,.

      type Mutation { fieldName: Field.returnType }

      Parameters:
      fieldName - the name of the Mutation. This parameter is required.
      field - the resolvable field to for this Mutation. This parameter is required.
    • addQuery

      @Stability(Experimental) @NotNull public ObjectType addQuery(@NotNull String fieldName, @NotNull ResolvableField field)
      (experimental) Add a query field to the schema's Query. CDK will create an Object Type called 'Query'. For example,.

      type Query { fieldName: Field.returnType }

      Parameters:
      fieldName - the name of the query. This parameter is required.
      field - the resolvable field to for this query. This parameter is required.
    • addSchemaDependency

      @Stability(Experimental) @NotNull public Boolean addSchemaDependency(@NotNull CfnResource construct)
      (experimental) 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.
    • addSubscription

      @Stability(Experimental) @NotNull public ObjectType addSubscription(@NotNull String fieldName, @NotNull ResolvableField field)
      (experimental) Add a subscription field to the schema's Subscription. CDK will create an Object Type called 'Subscription'. For example,.

      type Subscription { fieldName: Field.returnType }

      Parameters:
      fieldName - the name of the Subscription. This parameter is required.
      field - the resolvable field to for this Subscription. This parameter is required.
    • addToSchema

      @Stability(Experimental) public void addToSchema(@NotNull String addition, @Nullable String delimiter)
      (experimental) Escape hatch to append to Schema as desired.

      Will always result in a newline.

      Default: - ''

      Parameters:
      addition - the addition to add to schema. This parameter is required.
      delimiter - the delimiter between schema and addition.
    • addToSchema

      @Stability(Experimental) public void addToSchema(@NotNull String addition)
      (experimental) Escape hatch to append to Schema as desired.

      Will always result in a newline.

      Default: - ''

      Parameters:
      addition - the addition to add to schema. This parameter is required.
    • addType

      @Stability(Experimental) @NotNull public IIntermediateType addType(@NotNull IIntermediateType type)
      (experimental) Add type to the schema.

      Parameters:
      type - the intermediate type to add to the schema. This parameter is required.
    • grant

      @Stability(Experimental) @NotNull public Grant grant(@NotNull IGrantable grantee, @NotNull IamResource resources, @NotNull @NotNull String... actions)
      (experimental) 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(Experimental) @NotNull public Grant grantMutation(@NotNull IGrantable grantee, @NotNull @NotNull String... fields)
      (experimental) 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(Experimental) @NotNull public Grant grantQuery(@NotNull IGrantable grantee, @NotNull @NotNull String... fields)
      (experimental) 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(Experimental) @NotNull public Grant grantSubscription(@NotNull IGrantable grantee, @NotNull @NotNull String... fields)
      (experimental) 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(Experimental) @NotNull public String getApiId()
      (experimental) an unique AWS AppSync GraphQL API identifier i.e. 'lxz775lwdrgcndgz3nurvac7oa'.
      Specified by:
      getApiId in interface IGraphqlApi
      Specified by:
      getApiId in class GraphqlApiBase
    • getArn

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

      @Stability(Experimental) @NotNull public String getGraphqlUrl()
      (experimental) the URL of the endpoint created by AppSync.
    • getModes

      @Stability(Experimental) @NotNull public List<AuthorizationType> getModes()
      (experimental) The Authorization Types for this GraphQL Api.
    • getName

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

      @Stability(Experimental) @NotNull public Schema getSchema()
      (experimental) the schema attached to this api.
    • getApiKey

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

      Default: - no api key