software.amazon.awscdk.integtests.alpha.HttpResponse Maven / Gradle / Ivy
Show all versions of cdk-integ-tests-alpha Show documentation
package software.amazon.awscdk.integtests.alpha;
/**
* (experimental) Response from fetch.
*
* 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.*;
* Object body;
* Object headers;
* HttpResponse httpResponse = HttpResponse.builder()
* .body(body)
* .headers(Map.of(
* "headersKey", headers))
* .ok(false)
* .status(123)
* .statusText("statusText")
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.102.0 (build e354887)", date = "2024-08-23T05:56:25.353Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.integtests.alpha.$Module.class, fqn = "@aws-cdk/integ-tests-alpha.HttpResponse")
@software.amazon.jsii.Jsii.Proxy(HttpResponse.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface HttpResponse extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The response, either as parsed JSON or a string literal.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Object getBody() {
return null;
}
/**
* (experimental) Headers associated with the response.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.Map getHeaders() {
return null;
}
/**
* (experimental) Indicates whether the response was successful.
*
* status range 200-299
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getOk() {
return null;
}
/**
* (experimental) Status code of the response.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getStatus() {
return null;
}
/**
* (experimental) The status message corresponding to the status code.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getStatusText() {
return null;
}
/**
* @return a {@link Builder} of {@link HttpResponse}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link HttpResponse}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.Object body;
java.util.Map headers;
java.lang.Boolean ok;
java.lang.Number status;
java.lang.String statusText;
/**
* Sets the value of {@link HttpResponse#getBody}
* @param body The response, either as parsed JSON or a string literal.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder body(java.lang.Object body) {
this.body = body;
return this;
}
/**
* Sets the value of {@link HttpResponse#getHeaders}
* @param headers Headers associated with the response.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder headers(java.util.Map headers) {
this.headers = (java.util.Map)headers;
return this;
}
/**
* Sets the value of {@link HttpResponse#getOk}
* @param ok Indicates whether the response was successful.
* status range 200-299
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder ok(java.lang.Boolean ok) {
this.ok = ok;
return this;
}
/**
* Sets the value of {@link HttpResponse#getStatus}
* @param status Status code of the response.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder status(java.lang.Number status) {
this.status = status;
return this;
}
/**
* Sets the value of {@link HttpResponse#getStatusText}
* @param statusText The status message corresponding to the status code.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder statusText(java.lang.String statusText) {
this.statusText = statusText;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link HttpResponse}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public HttpResponse build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link HttpResponse}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements HttpResponse {
private final java.lang.Object body;
private final java.util.Map headers;
private final java.lang.Boolean ok;
private final java.lang.Number status;
private final java.lang.String statusText;
/**
* 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.Object.class));
this.headers = software.amazon.jsii.Kernel.get(this, "headers", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.Object.class)));
this.ok = software.amazon.jsii.Kernel.get(this, "ok", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.status = software.amazon.jsii.Kernel.get(this, "status", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.statusText = software.amazon.jsii.Kernel.get(this, "statusText", software.amazon.jsii.NativeType.forClass(java.lang.String.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.body = builder.body;
this.headers = (java.util.Map)builder.headers;
this.ok = builder.ok;
this.status = builder.status;
this.statusText = builder.statusText;
}
@Override
public final java.lang.Object getBody() {
return this.body;
}
@Override
public final java.util.Map getHeaders() {
return this.headers;
}
@Override
public final java.lang.Boolean getOk() {
return this.ok;
}
@Override
public final java.lang.Number getStatus() {
return this.status;
}
@Override
public final java.lang.String getStatusText() {
return this.statusText;
}
@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.getOk() != null) {
data.set("ok", om.valueToTree(this.getOk()));
}
if (this.getStatus() != null) {
data.set("status", om.valueToTree(this.getStatus()));
}
if (this.getStatusText() != null) {
data.set("statusText", om.valueToTree(this.getStatusText()));
}
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.HttpResponse"));
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;
HttpResponse.Jsii$Proxy that = (HttpResponse.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.ok != null ? !this.ok.equals(that.ok) : that.ok != null) return false;
if (this.status != null ? !this.status.equals(that.status) : that.status != null) return false;
return this.statusText != null ? this.statusText.equals(that.statusText) : that.statusText == 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.ok != null ? this.ok.hashCode() : 0);
result = 31 * result + (this.status != null ? this.status.hashCode() : 0);
result = 31 * result + (this.statusText != null ? this.statusText.hashCode() : 0);
return result;
}
}
}