software.amazon.awscdk.services.appsync.ExtendedResolverProps Maven / Gradle / Ivy
Show all versions of appsync Show documentation
package software.amazon.awscdk.services.appsync;
/**
* (experimental) Additional property for an AppSync resolver for data source reference.
*
* Example:
*
*
* // The code below shows an example of how to instantiate this type.
* // The values are placeholders you should change.
* import software.amazon.awscdk.services.appsync.*;
* import software.amazon.awscdk.core.*;
* AppsyncFunction appsyncFunction;
* BaseDataSource baseDataSource;
* MappingTemplate mappingTemplate;
* ExtendedResolverProps extendedResolverProps = ExtendedResolverProps.builder()
* .fieldName("fieldName")
* .typeName("typeName")
* // the properties below are optional
* .cachingConfig(CachingConfig.builder()
* .ttl(Duration.minutes(30))
* // the properties below are optional
* .cachingKeys(List.of("cachingKeys"))
* .build())
* .dataSource(baseDataSource)
* .pipelineConfig(List.of(appsyncFunction))
* .requestMappingTemplate(mappingTemplate)
* .responseMappingTemplate(mappingTemplate)
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.72.0 (build 4b8828b)", date = "2023-01-03T16:22:41.808Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.appsync.$Module.class, fqn = "@aws-cdk/aws-appsync.ExtendedResolverProps")
@software.amazon.jsii.Jsii.Proxy(ExtendedResolverProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface ExtendedResolverProps extends software.amazon.jsii.JsiiSerializable, software.amazon.awscdk.services.appsync.BaseResolverProps {
/**
* (experimental) The data source this resolver is using.
*
* Default: - No datasource
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.appsync.BaseDataSource getDataSource() {
return null;
}
/**
* @return a {@link Builder} of {@link ExtendedResolverProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link ExtendedResolverProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
software.amazon.awscdk.services.appsync.BaseDataSource dataSource;
java.lang.String fieldName;
java.lang.String typeName;
software.amazon.awscdk.services.appsync.CachingConfig cachingConfig;
java.util.List pipelineConfig;
software.amazon.awscdk.services.appsync.MappingTemplate requestMappingTemplate;
software.amazon.awscdk.services.appsync.MappingTemplate responseMappingTemplate;
/**
* Sets the value of {@link ExtendedResolverProps#getDataSource}
* @param dataSource The data source this resolver is using.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder dataSource(software.amazon.awscdk.services.appsync.BaseDataSource dataSource) {
this.dataSource = dataSource;
return this;
}
/**
* Sets the value of {@link ExtendedResolverProps#getFieldName}
* @param fieldName name of the GraphQL field in the given type this resolver is attached to. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder fieldName(java.lang.String fieldName) {
this.fieldName = fieldName;
return this;
}
/**
* Sets the value of {@link ExtendedResolverProps#getTypeName}
* @param typeName name of the GraphQL type this resolver is attached to. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder typeName(java.lang.String typeName) {
this.typeName = typeName;
return this;
}
/**
* Sets the value of {@link ExtendedResolverProps#getCachingConfig}
* @param cachingConfig The caching configuration for this resolver.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder cachingConfig(software.amazon.awscdk.services.appsync.CachingConfig cachingConfig) {
this.cachingConfig = cachingConfig;
return this;
}
/**
* Sets the value of {@link ExtendedResolverProps#getPipelineConfig}
* @param pipelineConfig configuration of the pipeline resolver.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder pipelineConfig(java.util.List extends software.amazon.awscdk.services.appsync.IAppsyncFunction> pipelineConfig) {
this.pipelineConfig = (java.util.List)pipelineConfig;
return this;
}
/**
* Sets the value of {@link ExtendedResolverProps#getRequestMappingTemplate}
* @param requestMappingTemplate The request mapping template for this resolver.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder requestMappingTemplate(software.amazon.awscdk.services.appsync.MappingTemplate requestMappingTemplate) {
this.requestMappingTemplate = requestMappingTemplate;
return this;
}
/**
* Sets the value of {@link ExtendedResolverProps#getResponseMappingTemplate}
* @param responseMappingTemplate The response mapping template for this resolver.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder responseMappingTemplate(software.amazon.awscdk.services.appsync.MappingTemplate responseMappingTemplate) {
this.responseMappingTemplate = responseMappingTemplate;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link ExtendedResolverProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public ExtendedResolverProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link ExtendedResolverProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ExtendedResolverProps {
private final software.amazon.awscdk.services.appsync.BaseDataSource dataSource;
private final java.lang.String fieldName;
private final java.lang.String typeName;
private final software.amazon.awscdk.services.appsync.CachingConfig cachingConfig;
private final java.util.List pipelineConfig;
private final software.amazon.awscdk.services.appsync.MappingTemplate requestMappingTemplate;
private final software.amazon.awscdk.services.appsync.MappingTemplate responseMappingTemplate;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.dataSource = software.amazon.jsii.Kernel.get(this, "dataSource", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.appsync.BaseDataSource.class));
this.fieldName = software.amazon.jsii.Kernel.get(this, "fieldName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.typeName = software.amazon.jsii.Kernel.get(this, "typeName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.cachingConfig = software.amazon.jsii.Kernel.get(this, "cachingConfig", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.appsync.CachingConfig.class));
this.pipelineConfig = software.amazon.jsii.Kernel.get(this, "pipelineConfig", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.appsync.IAppsyncFunction.class)));
this.requestMappingTemplate = software.amazon.jsii.Kernel.get(this, "requestMappingTemplate", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.appsync.MappingTemplate.class));
this.responseMappingTemplate = software.amazon.jsii.Kernel.get(this, "responseMappingTemplate", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.appsync.MappingTemplate.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.dataSource = builder.dataSource;
this.fieldName = java.util.Objects.requireNonNull(builder.fieldName, "fieldName is required");
this.typeName = java.util.Objects.requireNonNull(builder.typeName, "typeName is required");
this.cachingConfig = builder.cachingConfig;
this.pipelineConfig = (java.util.List)builder.pipelineConfig;
this.requestMappingTemplate = builder.requestMappingTemplate;
this.responseMappingTemplate = builder.responseMappingTemplate;
}
@Override
public final software.amazon.awscdk.services.appsync.BaseDataSource getDataSource() {
return this.dataSource;
}
@Override
public final java.lang.String getFieldName() {
return this.fieldName;
}
@Override
public final java.lang.String getTypeName() {
return this.typeName;
}
@Override
public final software.amazon.awscdk.services.appsync.CachingConfig getCachingConfig() {
return this.cachingConfig;
}
@Override
public final java.util.List getPipelineConfig() {
return this.pipelineConfig;
}
@Override
public final software.amazon.awscdk.services.appsync.MappingTemplate getRequestMappingTemplate() {
return this.requestMappingTemplate;
}
@Override
public final software.amazon.awscdk.services.appsync.MappingTemplate getResponseMappingTemplate() {
return this.responseMappingTemplate;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
if (this.getDataSource() != null) {
data.set("dataSource", om.valueToTree(this.getDataSource()));
}
data.set("fieldName", om.valueToTree(this.getFieldName()));
data.set("typeName", om.valueToTree(this.getTypeName()));
if (this.getCachingConfig() != null) {
data.set("cachingConfig", om.valueToTree(this.getCachingConfig()));
}
if (this.getPipelineConfig() != null) {
data.set("pipelineConfig", om.valueToTree(this.getPipelineConfig()));
}
if (this.getRequestMappingTemplate() != null) {
data.set("requestMappingTemplate", om.valueToTree(this.getRequestMappingTemplate()));
}
if (this.getResponseMappingTemplate() != null) {
data.set("responseMappingTemplate", om.valueToTree(this.getResponseMappingTemplate()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-appsync.ExtendedResolverProps"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ExtendedResolverProps.Jsii$Proxy that = (ExtendedResolverProps.Jsii$Proxy) o;
if (this.dataSource != null ? !this.dataSource.equals(that.dataSource) : that.dataSource != null) return false;
if (!fieldName.equals(that.fieldName)) return false;
if (!typeName.equals(that.typeName)) return false;
if (this.cachingConfig != null ? !this.cachingConfig.equals(that.cachingConfig) : that.cachingConfig != null) return false;
if (this.pipelineConfig != null ? !this.pipelineConfig.equals(that.pipelineConfig) : that.pipelineConfig != null) return false;
if (this.requestMappingTemplate != null ? !this.requestMappingTemplate.equals(that.requestMappingTemplate) : that.requestMappingTemplate != null) return false;
return this.responseMappingTemplate != null ? this.responseMappingTemplate.equals(that.responseMappingTemplate) : that.responseMappingTemplate == null;
}
@Override
public final int hashCode() {
int result = this.dataSource != null ? this.dataSource.hashCode() : 0;
result = 31 * result + (this.fieldName.hashCode());
result = 31 * result + (this.typeName.hashCode());
result = 31 * result + (this.cachingConfig != null ? this.cachingConfig.hashCode() : 0);
result = 31 * result + (this.pipelineConfig != null ? this.pipelineConfig.hashCode() : 0);
result = 31 * result + (this.requestMappingTemplate != null ? this.requestMappingTemplate.hashCode() : 0);
result = 31 * result + (this.responseMappingTemplate != null ? this.responseMappingTemplate.hashCode() : 0);
return result;
}
}
}