Class SchemaFile

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.appsync.SchemaFile
All Implemented Interfaces:
ISchema, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.99.0 (build 8f757e4)", date="2024-06-13T18:49:14.687Z") @Stability(Stable) public class SchemaFile extends software.amazon.jsii.JsiiObject implements ISchema
The Schema for a GraphQL Api.

If no options are configured, schema will be generated code-first.

Example:

 import software.amazon.awscdk.services.certificatemanager.*;
 import software.amazon.awscdk.services.route53.*;
 // hosted zone and route53 features
 String hostedZoneId;
 String zoneName = "example.com";
 String myDomainName = "api.example.com";
 Certificate certificate = Certificate.Builder.create(this, "cert").domainName(myDomainName).build();
 SchemaFile schema = SchemaFile.Builder.create().filePath("mySchemaFile").build();
 GraphqlApi api = GraphqlApi.Builder.create(this, "api")
         .name("myApi")
         .definition(Definition.fromSchema(schema))
         .domainName(DomainOptions.builder()
                 .certificate(certificate)
                 .domainName(myDomainName)
                 .build())
         .build();
 // hosted zone for adding appsync domain
 IHostedZone zone = HostedZone.fromHostedZoneAttributes(this, "HostedZone", HostedZoneAttributes.builder()
         .hostedZoneId(hostedZoneId)
         .zoneName(zoneName)
         .build());
 // create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
 // create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
 CnameRecord.Builder.create(this, "CnameApiRecord")
         .recordName("api")
         .zone(zone)
         .domainName(api.getAppSyncDomainName())
         .build();
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A fluent builder for SchemaFile.

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode

    Nested classes/interfaces inherited from interface software.amazon.awscdk.services.appsync.ISchema

    ISchema.Jsii$Default, ISchema.Jsii$Proxy
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
     
    protected
    SchemaFile(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    SchemaFile(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Called when the GraphQL Api is initialized to allow this object to bind to the stack.
    Called when the GraphQL Api is initialized to allow this object to bind to the stack.
    static SchemaFile
    fromAsset(String filePath)
    Generate a Schema from file.
    The definition for this schema.
    void
    The definition for this schema.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • SchemaFile

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

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

      @Stability(Stable) public SchemaFile(@NotNull SchemaProps options)
      Parameters:
      options - This parameter is required.
  • Method Details

    • fromAsset

      @Stability(Stable) @NotNull public static SchemaFile fromAsset(@NotNull String filePath)
      Generate a Schema from file.

      Parameters:
      filePath - the file path of the schema file. This parameter is required.
      Returns:
      SchemaAsset with immutable schema defintion
    • bind

      @Stability(Stable) @NotNull public ISchemaConfig bind(@NotNull IGraphqlApi api, @Nullable SchemaBindOptions _options)
      Called when the GraphQL Api is initialized to allow this object to bind to the stack.

      Specified by:
      bind in interface ISchema
      Parameters:
      api - The binding GraphQL Api. This parameter is required.
      _options -
      Returns:
      ISchemaConfig with apiId and schema definition string
    • bind

      @Stability(Stable) @NotNull public ISchemaConfig bind(@NotNull IGraphqlApi api)
      Called when the GraphQL Api is initialized to allow this object to bind to the stack.

      Specified by:
      bind in interface ISchema
      Parameters:
      api - The binding GraphQL Api. This parameter is required.
      Returns:
      ISchemaConfig with apiId and schema definition string
    • getDefinition

      @Stability(Stable) @NotNull public String getDefinition()
      The definition for this schema.
    • setDefinition

      @Stability(Stable) public void setDefinition(@NotNull String value)
      The definition for this schema.