io.github.cdklabs.generative_ai_cdk_constructs.CrawlerTarget Maven / Gradle / Ivy
package io.github.cdklabs.generative_ai_cdk_constructs;
/**
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-07T16:14:00.530Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.generative_ai_cdk_constructs.$Module.class, fqn = "@cdklabs/generative-ai-cdk-constructs.CrawlerTarget")
@software.amazon.jsii.Jsii.Proxy(CrawlerTarget.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface CrawlerTarget extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Type of URL to be crawled.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.CrawlerTargetType getTargetType();
/**
* (experimental) Target URL to be crawled.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getUrl();
/**
* (experimental) Schedule the crawler to run every N hours following the completion of the previous job.
*
* Default: - not scheduled
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getCrawlIntervalHours() {
return null;
}
/**
* (experimental) Download files from the web site.
*
* Default: - true
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getDownloadFiles() {
return null;
}
/**
* (experimental) File types (extensions) to be downloaded.
*
* Default: - all file types
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getFileTypes() {
return null;
}
/**
* (experimental) Maximum number of files to be downloaded.
*
* Default: - crawler limit
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getMaxFiles() {
return null;
}
/**
* (experimental) Maximum number of requests to be made by crawler.
*
* Default: - crawler limit
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getMaxRequests() {
return null;
}
/**
* @return a {@link Builder} of {@link CrawlerTarget}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link CrawlerTarget}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
io.github.cdklabs.generative_ai_cdk_constructs.CrawlerTargetType targetType;
java.lang.String url;
java.lang.Number crawlIntervalHours;
java.lang.Boolean downloadFiles;
java.util.List fileTypes;
java.lang.Number maxFiles;
java.lang.Number maxRequests;
/**
* Sets the value of {@link CrawlerTarget#getTargetType}
* @param targetType Type of URL to be crawled. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder targetType(io.github.cdklabs.generative_ai_cdk_constructs.CrawlerTargetType targetType) {
this.targetType = targetType;
return this;
}
/**
* Sets the value of {@link CrawlerTarget#getUrl}
* @param url Target URL to be crawled. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder url(java.lang.String url) {
this.url = url;
return this;
}
/**
* Sets the value of {@link CrawlerTarget#getCrawlIntervalHours}
* @param crawlIntervalHours Schedule the crawler to run every N hours following the completion of the previous job.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder crawlIntervalHours(java.lang.Number crawlIntervalHours) {
this.crawlIntervalHours = crawlIntervalHours;
return this;
}
/**
* Sets the value of {@link CrawlerTarget#getDownloadFiles}
* @param downloadFiles Download files from the web site.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder downloadFiles(java.lang.Boolean downloadFiles) {
this.downloadFiles = downloadFiles;
return this;
}
/**
* Sets the value of {@link CrawlerTarget#getFileTypes}
* @param fileTypes File types (extensions) to be downloaded.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder fileTypes(java.util.List fileTypes) {
this.fileTypes = fileTypes;
return this;
}
/**
* Sets the value of {@link CrawlerTarget#getMaxFiles}
* @param maxFiles Maximum number of files to be downloaded.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maxFiles(java.lang.Number maxFiles) {
this.maxFiles = maxFiles;
return this;
}
/**
* Sets the value of {@link CrawlerTarget#getMaxRequests}
* @param maxRequests Maximum number of requests to be made by crawler.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maxRequests(java.lang.Number maxRequests) {
this.maxRequests = maxRequests;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link CrawlerTarget}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public CrawlerTarget build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link CrawlerTarget}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements CrawlerTarget {
private final io.github.cdklabs.generative_ai_cdk_constructs.CrawlerTargetType targetType;
private final java.lang.String url;
private final java.lang.Number crawlIntervalHours;
private final java.lang.Boolean downloadFiles;
private final java.util.List fileTypes;
private final java.lang.Number maxFiles;
private final java.lang.Number maxRequests;
/**
* 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.targetType = software.amazon.jsii.Kernel.get(this, "targetType", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.CrawlerTargetType.class));
this.url = software.amazon.jsii.Kernel.get(this, "url", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.crawlIntervalHours = software.amazon.jsii.Kernel.get(this, "crawlIntervalHours", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.downloadFiles = software.amazon.jsii.Kernel.get(this, "downloadFiles", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.fileTypes = software.amazon.jsii.Kernel.get(this, "fileTypes", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.maxFiles = software.amazon.jsii.Kernel.get(this, "maxFiles", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.maxRequests = software.amazon.jsii.Kernel.get(this, "maxRequests", software.amazon.jsii.NativeType.forClass(java.lang.Number.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.targetType = java.util.Objects.requireNonNull(builder.targetType, "targetType is required");
this.url = java.util.Objects.requireNonNull(builder.url, "url is required");
this.crawlIntervalHours = builder.crawlIntervalHours;
this.downloadFiles = builder.downloadFiles;
this.fileTypes = builder.fileTypes;
this.maxFiles = builder.maxFiles;
this.maxRequests = builder.maxRequests;
}
@Override
public final io.github.cdklabs.generative_ai_cdk_constructs.CrawlerTargetType getTargetType() {
return this.targetType;
}
@Override
public final java.lang.String getUrl() {
return this.url;
}
@Override
public final java.lang.Number getCrawlIntervalHours() {
return this.crawlIntervalHours;
}
@Override
public final java.lang.Boolean getDownloadFiles() {
return this.downloadFiles;
}
@Override
public final java.util.List getFileTypes() {
return this.fileTypes;
}
@Override
public final java.lang.Number getMaxFiles() {
return this.maxFiles;
}
@Override
public final java.lang.Number getMaxRequests() {
return this.maxRequests;
}
@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("targetType", om.valueToTree(this.getTargetType()));
data.set("url", om.valueToTree(this.getUrl()));
if (this.getCrawlIntervalHours() != null) {
data.set("crawlIntervalHours", om.valueToTree(this.getCrawlIntervalHours()));
}
if (this.getDownloadFiles() != null) {
data.set("downloadFiles", om.valueToTree(this.getDownloadFiles()));
}
if (this.getFileTypes() != null) {
data.set("fileTypes", om.valueToTree(this.getFileTypes()));
}
if (this.getMaxFiles() != null) {
data.set("maxFiles", om.valueToTree(this.getMaxFiles()));
}
if (this.getMaxRequests() != null) {
data.set("maxRequests", om.valueToTree(this.getMaxRequests()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@cdklabs/generative-ai-cdk-constructs.CrawlerTarget"));
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;
CrawlerTarget.Jsii$Proxy that = (CrawlerTarget.Jsii$Proxy) o;
if (!targetType.equals(that.targetType)) return false;
if (!url.equals(that.url)) return false;
if (this.crawlIntervalHours != null ? !this.crawlIntervalHours.equals(that.crawlIntervalHours) : that.crawlIntervalHours != null) return false;
if (this.downloadFiles != null ? !this.downloadFiles.equals(that.downloadFiles) : that.downloadFiles != null) return false;
if (this.fileTypes != null ? !this.fileTypes.equals(that.fileTypes) : that.fileTypes != null) return false;
if (this.maxFiles != null ? !this.maxFiles.equals(that.maxFiles) : that.maxFiles != null) return false;
return this.maxRequests != null ? this.maxRequests.equals(that.maxRequests) : that.maxRequests == null;
}
@Override
public final int hashCode() {
int result = this.targetType.hashCode();
result = 31 * result + (this.url.hashCode());
result = 31 * result + (this.crawlIntervalHours != null ? this.crawlIntervalHours.hashCode() : 0);
result = 31 * result + (this.downloadFiles != null ? this.downloadFiles.hashCode() : 0);
result = 31 * result + (this.fileTypes != null ? this.fileTypes.hashCode() : 0);
result = 31 * result + (this.maxFiles != null ? this.maxFiles.hashCode() : 0);
result = 31 * result + (this.maxRequests != null ? this.maxRequests.hashCode() : 0);
return result;
}
}
}