software.aws.awsprototypingsdk.openapigateway.OpenApiOptions Maven / Gradle / Ivy
Show all versions of open-api-gateway Show documentation
package software.aws.awsprototypingsdk.openapigateway;
/**
* (experimental) Options required alongside an Open API specification to create API Gateway resources.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.82.0 (build 2d2ddd7)", date = "2023-08-15T05:38:04.727Z")
@software.amazon.jsii.Jsii(module = software.aws.awsprototypingsdk.openapigateway.$Module.class, fqn = "@aws-prototyping-sdk/open-api-gateway.OpenApiOptions")
@software.amazon.jsii.Jsii.Proxy(OpenApiOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface OpenApiOptions extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) A mapping of API operation to its integration.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.util.Map getIntegrations();
/**
* (experimental) Details about each operation.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.util.Map getOperationLookup();
/**
* (experimental) Cross Origin Resource Sharing options for the API.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.apigateway.CorsOptions getCorsOptions() {
return null;
}
/**
* (experimental) The default authorizer to use for your api.
*
* When omitted, no default authorizer is used.
* Authorizers specified at the integration level will override this for that operation.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.aws.awsprototypingsdk.openapigateway.Authorizer getDefaultAuthorizer() {
return null;
}
/**
* @return a {@link Builder} of {@link OpenApiOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link OpenApiOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.util.Map integrations;
java.util.Map operationLookup;
software.amazon.awscdk.services.apigateway.CorsOptions corsOptions;
software.aws.awsprototypingsdk.openapigateway.Authorizer defaultAuthorizer;
/**
* Sets the value of {@link OpenApiOptions#getIntegrations}
* @param integrations A mapping of API operation to its integration. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder integrations(java.util.Map integrations) {
this.integrations = (java.util.Map)integrations;
return this;
}
/**
* Sets the value of {@link OpenApiOptions#getOperationLookup}
* @param operationLookup Details about each operation. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder operationLookup(java.util.Map operationLookup) {
this.operationLookup = (java.util.Map)operationLookup;
return this;
}
/**
* Sets the value of {@link OpenApiOptions#getCorsOptions}
* @param corsOptions Cross Origin Resource Sharing options for the API.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder corsOptions(software.amazon.awscdk.services.apigateway.CorsOptions corsOptions) {
this.corsOptions = corsOptions;
return this;
}
/**
* Sets the value of {@link OpenApiOptions#getDefaultAuthorizer}
* @param defaultAuthorizer The default authorizer to use for your api.
* When omitted, no default authorizer is used.
* Authorizers specified at the integration level will override this for that operation.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder defaultAuthorizer(software.aws.awsprototypingsdk.openapigateway.Authorizer defaultAuthorizer) {
this.defaultAuthorizer = defaultAuthorizer;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link OpenApiOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public OpenApiOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link OpenApiOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements OpenApiOptions {
private final java.util.Map integrations;
private final java.util.Map operationLookup;
private final software.amazon.awscdk.services.apigateway.CorsOptions corsOptions;
private final software.aws.awsprototypingsdk.openapigateway.Authorizer defaultAuthorizer;
/**
* 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.integrations = software.amazon.jsii.Kernel.get(this, "integrations", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(software.aws.awsprototypingsdk.openapigateway.OpenApiIntegration.class)));
this.operationLookup = software.amazon.jsii.Kernel.get(this, "operationLookup", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(software.aws.awsprototypingsdk.openapigateway.MethodAndPath.class)));
this.corsOptions = software.amazon.jsii.Kernel.get(this, "corsOptions", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.apigateway.CorsOptions.class));
this.defaultAuthorizer = software.amazon.jsii.Kernel.get(this, "defaultAuthorizer", software.amazon.jsii.NativeType.forClass(software.aws.awsprototypingsdk.openapigateway.Authorizer.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.integrations = (java.util.Map)java.util.Objects.requireNonNull(builder.integrations, "integrations is required");
this.operationLookup = (java.util.Map)java.util.Objects.requireNonNull(builder.operationLookup, "operationLookup is required");
this.corsOptions = builder.corsOptions;
this.defaultAuthorizer = builder.defaultAuthorizer;
}
@Override
public final java.util.Map getIntegrations() {
return this.integrations;
}
@Override
public final java.util.Map getOperationLookup() {
return this.operationLookup;
}
@Override
public final software.amazon.awscdk.services.apigateway.CorsOptions getCorsOptions() {
return this.corsOptions;
}
@Override
public final software.aws.awsprototypingsdk.openapigateway.Authorizer getDefaultAuthorizer() {
return this.defaultAuthorizer;
}
@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();
data.set("integrations", om.valueToTree(this.getIntegrations()));
data.set("operationLookup", om.valueToTree(this.getOperationLookup()));
if (this.getCorsOptions() != null) {
data.set("corsOptions", om.valueToTree(this.getCorsOptions()));
}
if (this.getDefaultAuthorizer() != null) {
data.set("defaultAuthorizer", om.valueToTree(this.getDefaultAuthorizer()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-prototyping-sdk/open-api-gateway.OpenApiOptions"));
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;
OpenApiOptions.Jsii$Proxy that = (OpenApiOptions.Jsii$Proxy) o;
if (!integrations.equals(that.integrations)) return false;
if (!operationLookup.equals(that.operationLookup)) return false;
if (this.corsOptions != null ? !this.corsOptions.equals(that.corsOptions) : that.corsOptions != null) return false;
return this.defaultAuthorizer != null ? this.defaultAuthorizer.equals(that.defaultAuthorizer) : that.defaultAuthorizer == null;
}
@Override
public final int hashCode() {
int result = this.integrations.hashCode();
result = 31 * result + (this.operationLookup.hashCode());
result = 31 * result + (this.corsOptions != null ? this.corsOptions.hashCode() : 0);
result = 31 * result + (this.defaultAuthorizer != null ? this.defaultAuthorizer.hashCode() : 0);
return result;
}
}
}