software.aws.awsprototypingsdk.openapigateway.CustomAuthorizerProps Maven / Gradle / Ivy
Show all versions of open-api-gateway Show documentation
package software.aws.awsprototypingsdk.openapigateway;
/**
* (experimental) Properties used to configure a custom authorizer.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.82.0 (build 2d2ddd7)", date = "2023-08-15T05:38:04.575Z")
@software.amazon.jsii.Jsii(module = software.aws.awsprototypingsdk.openapigateway.$Module.class, fqn = "@aws-prototyping-sdk/open-api-gateway.CustomAuthorizerProps")
@software.amazon.jsii.Jsii.Proxy(CustomAuthorizerProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface CustomAuthorizerProps extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Unique identifier for this authorizer.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getAuthorizerId();
/**
* (experimental) The lambda function used to authorize requests.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.IFunction getFunction();
/**
* (experimental) The number of seconds during which the authorizer result is cached.
*
* Default: 300
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getAuthorizerResultTtlInSeconds() {
return null;
}
/**
* (experimental) The source of the identity in an incoming request.
*
* Default: "method.request.header.Authorization"
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-identitysource
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getIdentitySource() {
return null;
}
/**
* (experimental) The type of custom authorizer.
*
* Default: CustomAuthorizerType.TOKEN
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-type
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.aws.awsprototypingsdk.openapigateway.CustomAuthorizerType getType() {
return null;
}
/**
* @return a {@link Builder} of {@link CustomAuthorizerProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link CustomAuthorizerProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String authorizerId;
software.amazon.awscdk.services.lambda.IFunction function;
java.lang.Number authorizerResultTtlInSeconds;
java.lang.String identitySource;
software.aws.awsprototypingsdk.openapigateway.CustomAuthorizerType type;
/**
* Sets the value of {@link CustomAuthorizerProps#getAuthorizerId}
* @param authorizerId Unique identifier for this authorizer. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder authorizerId(java.lang.String authorizerId) {
this.authorizerId = authorizerId;
return this;
}
/**
* Sets the value of {@link CustomAuthorizerProps#getFunction}
* @param function The lambda function used to authorize requests. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder function(software.amazon.awscdk.services.lambda.IFunction function) {
this.function = function;
return this;
}
/**
* Sets the value of {@link CustomAuthorizerProps#getAuthorizerResultTtlInSeconds}
* @param authorizerResultTtlInSeconds The number of seconds during which the authorizer result is cached.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder authorizerResultTtlInSeconds(java.lang.Number authorizerResultTtlInSeconds) {
this.authorizerResultTtlInSeconds = authorizerResultTtlInSeconds;
return this;
}
/**
* Sets the value of {@link CustomAuthorizerProps#getIdentitySource}
* @param identitySource The source of the identity in an incoming request.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder identitySource(java.lang.String identitySource) {
this.identitySource = identitySource;
return this;
}
/**
* Sets the value of {@link CustomAuthorizerProps#getType}
* @param type The type of custom authorizer.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder type(software.aws.awsprototypingsdk.openapigateway.CustomAuthorizerType type) {
this.type = type;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link CustomAuthorizerProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public CustomAuthorizerProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link CustomAuthorizerProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements CustomAuthorizerProps {
private final java.lang.String authorizerId;
private final software.amazon.awscdk.services.lambda.IFunction function;
private final java.lang.Number authorizerResultTtlInSeconds;
private final java.lang.String identitySource;
private final software.aws.awsprototypingsdk.openapigateway.CustomAuthorizerType type;
/**
* 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.authorizerId = software.amazon.jsii.Kernel.get(this, "authorizerId", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.function = software.amazon.jsii.Kernel.get(this, "function", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.lambda.IFunction.class));
this.authorizerResultTtlInSeconds = software.amazon.jsii.Kernel.get(this, "authorizerResultTtlInSeconds", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.identitySource = software.amazon.jsii.Kernel.get(this, "identitySource", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.type = software.amazon.jsii.Kernel.get(this, "type", software.amazon.jsii.NativeType.forClass(software.aws.awsprototypingsdk.openapigateway.CustomAuthorizerType.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.authorizerId = java.util.Objects.requireNonNull(builder.authorizerId, "authorizerId is required");
this.function = java.util.Objects.requireNonNull(builder.function, "function is required");
this.authorizerResultTtlInSeconds = builder.authorizerResultTtlInSeconds;
this.identitySource = builder.identitySource;
this.type = builder.type;
}
@Override
public final java.lang.String getAuthorizerId() {
return this.authorizerId;
}
@Override
public final software.amazon.awscdk.services.lambda.IFunction getFunction() {
return this.function;
}
@Override
public final java.lang.Number getAuthorizerResultTtlInSeconds() {
return this.authorizerResultTtlInSeconds;
}
@Override
public final java.lang.String getIdentitySource() {
return this.identitySource;
}
@Override
public final software.aws.awsprototypingsdk.openapigateway.CustomAuthorizerType getType() {
return this.type;
}
@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("authorizerId", om.valueToTree(this.getAuthorizerId()));
data.set("function", om.valueToTree(this.getFunction()));
if (this.getAuthorizerResultTtlInSeconds() != null) {
data.set("authorizerResultTtlInSeconds", om.valueToTree(this.getAuthorizerResultTtlInSeconds()));
}
if (this.getIdentitySource() != null) {
data.set("identitySource", om.valueToTree(this.getIdentitySource()));
}
if (this.getType() != null) {
data.set("type", om.valueToTree(this.getType()));
}
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.CustomAuthorizerProps"));
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;
CustomAuthorizerProps.Jsii$Proxy that = (CustomAuthorizerProps.Jsii$Proxy) o;
if (!authorizerId.equals(that.authorizerId)) return false;
if (!function.equals(that.function)) return false;
if (this.authorizerResultTtlInSeconds != null ? !this.authorizerResultTtlInSeconds.equals(that.authorizerResultTtlInSeconds) : that.authorizerResultTtlInSeconds != null) return false;
if (this.identitySource != null ? !this.identitySource.equals(that.identitySource) : that.identitySource != null) return false;
return this.type != null ? this.type.equals(that.type) : that.type == null;
}
@Override
public final int hashCode() {
int result = this.authorizerId.hashCode();
result = 31 * result + (this.function.hashCode());
result = 31 * result + (this.authorizerResultTtlInSeconds != null ? this.authorizerResultTtlInSeconds.hashCode() : 0);
result = 31 * result + (this.identitySource != null ? this.identitySource.hashCode() : 0);
result = 31 * result + (this.type != null ? this.type.hashCode() : 0);
return result;
}
}
}