software.amazon.awscdk.integtests.alpha.FetchOptions Maven / Gradle / Ivy
Show all versions of cdk-integ-tests-alpha Show documentation
package software.amazon.awscdk.integtests.alpha;
/**
* (experimental) Options to pass to the JavaScript fetch api.
*
* Example:
*
*
* // The code below shows an example of how to instantiate this type.
* // The values are placeholders you should change.
* import software.amazon.awscdk.integtests.alpha.*;
* FetchOptions fetchOptions = FetchOptions.builder()
* .body("body")
* .headers(Map.of(
* "headersKey", "headers"))
* .method("method")
* .port(123)
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.102.0 (build e354887)", date = "2024-08-23T05:56:25.351Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.integtests.alpha.$Module.class, fqn = "@aws-cdk/integ-tests-alpha.FetchOptions")
@software.amazon.jsii.Jsii.Proxy(FetchOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface FetchOptions extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Request body.
*
* Default: - no body
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getBody() {
return null;
}
/**
* (experimental) Optional request headers.
*
* Default: no headers
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.Map getHeaders() {
return null;
}
/**
* (experimental) HTTP method.
*
* Default: GET
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getMethod() {
return null;
}
/**
* (experimental) Optional port.
*
* Default: default port for protocol
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getPort() {
return null;
}
/**
* @return a {@link Builder} of {@link FetchOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link FetchOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String body;
java.util.Map headers;
java.lang.String method;
java.lang.Number port;
/**
* Sets the value of {@link FetchOptions#getBody}
* @param body Request body.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder body(java.lang.String body) {
this.body = body;
return this;
}
/**
* Sets the value of {@link FetchOptions#getHeaders}
* @param headers Optional request headers.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder headers(java.util.Map headers) {
this.headers = headers;
return this;
}
/**
* Sets the value of {@link FetchOptions#getMethod}
* @param method HTTP method.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder method(java.lang.String method) {
this.method = method;
return this;
}
/**
* Sets the value of {@link FetchOptions#getPort}
* @param port Optional port.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder port(java.lang.Number port) {
this.port = port;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link FetchOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public FetchOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link FetchOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements FetchOptions {
private final java.lang.String body;
private final java.util.Map headers;
private final java.lang.String method;
private final java.lang.Number port;
/**
* 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.body = software.amazon.jsii.Kernel.get(this, "body", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.headers = software.amazon.jsii.Kernel.get(this, "headers", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.method = software.amazon.jsii.Kernel.get(this, "method", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.port = software.amazon.jsii.Kernel.get(this, "port", 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.body = builder.body;
this.headers = builder.headers;
this.method = builder.method;
this.port = builder.port;
}
@Override
public final java.lang.String getBody() {
return this.body;
}
@Override
public final java.util.Map getHeaders() {
return this.headers;
}
@Override
public final java.lang.String getMethod() {
return this.method;
}
@Override
public final java.lang.Number getPort() {
return this.port;
}
@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.getBody() != null) {
data.set("body", om.valueToTree(this.getBody()));
}
if (this.getHeaders() != null) {
data.set("headers", om.valueToTree(this.getHeaders()));
}
if (this.getMethod() != null) {
data.set("method", om.valueToTree(this.getMethod()));
}
if (this.getPort() != null) {
data.set("port", om.valueToTree(this.getPort()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/integ-tests-alpha.FetchOptions"));
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;
FetchOptions.Jsii$Proxy that = (FetchOptions.Jsii$Proxy) o;
if (this.body != null ? !this.body.equals(that.body) : that.body != null) return false;
if (this.headers != null ? !this.headers.equals(that.headers) : that.headers != null) return false;
if (this.method != null ? !this.method.equals(that.method) : that.method != null) return false;
return this.port != null ? this.port.equals(that.port) : that.port == null;
}
@Override
public final int hashCode() {
int result = this.body != null ? this.body.hashCode() : 0;
result = 31 * result + (this.headers != null ? this.headers.hashCode() : 0);
result = 31 * result + (this.method != null ? this.method.hashCode() : 0);
result = 31 * result + (this.port != null ? this.port.hashCode() : 0);
return result;
}
}
}