io.github.cdklabs.cdk.ecs.codedeploy.ApiTestStep Maven / Gradle / Ivy
Show all versions of cdk-ecs-codedeploy Show documentation
package io.github.cdklabs.cdk.ecs.codedeploy;
/**
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-04T18:24:15.092Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdk.ecs.codedeploy.$Module.class, fqn = "@cdklabs/cdk-ecs-codedeploy.ApiTestStep")
@software.amazon.jsii.Jsii.Proxy(ApiTestStep.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface ApiTestStep extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Name of test.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getName();
/**
* (experimental) Path of HTTP request, relative to baseUrl.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getPath();
/**
* (experimental) Optional body to include in HTTP request.
*
* Default: - no body included.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getBody() {
return null;
}
/**
* (experimental) Expected value to compare against the jmesPath.
*
* Default: - undefined
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Object getExpectedValue() {
return null;
}
/**
* (experimental) Optional headers to include in HTTP request.
*
* Default: - no headers included.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.Map getHeaders() {
return null;
}
/**
* (experimental) JMESPath to apply against the response from the HTTP request and compare against expected value.
*
* Default: - no JMESPath assertion will be performed.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getJmesPath() {
return null;
}
/**
* (experimental) Optional method to for HTTP request.
*
* Default: - GET
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getMethod() {
return null;
}
/**
* @return a {@link Builder} of {@link ApiTestStep}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link ApiTestStep}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String name;
java.lang.String path;
java.lang.String body;
java.lang.Object expectedValue;
java.util.Map headers;
java.lang.String jmesPath;
java.lang.String method;
/**
* Sets the value of {@link ApiTestStep#getName}
* @param name Name of test. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder name(java.lang.String name) {
this.name = name;
return this;
}
/**
* Sets the value of {@link ApiTestStep#getPath}
* @param path Path of HTTP request, relative to baseUrl. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder path(java.lang.String path) {
this.path = path;
return this;
}
/**
* Sets the value of {@link ApiTestStep#getBody}
* @param body Optional body to include in HTTP request.
* @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 ApiTestStep#getExpectedValue}
* @param expectedValue Expected value to compare against the jmesPath.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder expectedValue(java.lang.Object expectedValue) {
this.expectedValue = expectedValue;
return this;
}
/**
* Sets the value of {@link ApiTestStep#getHeaders}
* @param headers Optional headers to include in HTTP request.
* @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 ApiTestStep#getJmesPath}
* @param jmesPath JMESPath to apply against the response from the HTTP request and compare against expected value.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder jmesPath(java.lang.String jmesPath) {
this.jmesPath = jmesPath;
return this;
}
/**
* Sets the value of {@link ApiTestStep#getMethod}
* @param method Optional method to for HTTP request.
* @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;
}
/**
* Builds the configured instance.
* @return a new instance of {@link ApiTestStep}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public ApiTestStep build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link ApiTestStep}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ApiTestStep {
private final java.lang.String name;
private final java.lang.String path;
private final java.lang.String body;
private final java.lang.Object expectedValue;
private final java.util.Map headers;
private final java.lang.String jmesPath;
private final java.lang.String method;
/**
* 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.name = software.amazon.jsii.Kernel.get(this, "name", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.path = software.amazon.jsii.Kernel.get(this, "path", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.body = software.amazon.jsii.Kernel.get(this, "body", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.expectedValue = software.amazon.jsii.Kernel.get(this, "expectedValue", 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.String.class)));
this.jmesPath = software.amazon.jsii.Kernel.get(this, "jmesPath", 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));
}
/**
* 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.name = java.util.Objects.requireNonNull(builder.name, "name is required");
this.path = java.util.Objects.requireNonNull(builder.path, "path is required");
this.body = builder.body;
this.expectedValue = builder.expectedValue;
this.headers = builder.headers;
this.jmesPath = builder.jmesPath;
this.method = builder.method;
}
@Override
public final java.lang.String getName() {
return this.name;
}
@Override
public final java.lang.String getPath() {
return this.path;
}
@Override
public final java.lang.String getBody() {
return this.body;
}
@Override
public final java.lang.Object getExpectedValue() {
return this.expectedValue;
}
@Override
public final java.util.Map getHeaders() {
return this.headers;
}
@Override
public final java.lang.String getJmesPath() {
return this.jmesPath;
}
@Override
public final java.lang.String getMethod() {
return this.method;
}
@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("name", om.valueToTree(this.getName()));
data.set("path", om.valueToTree(this.getPath()));
if (this.getBody() != null) {
data.set("body", om.valueToTree(this.getBody()));
}
if (this.getExpectedValue() != null) {
data.set("expectedValue", om.valueToTree(this.getExpectedValue()));
}
if (this.getHeaders() != null) {
data.set("headers", om.valueToTree(this.getHeaders()));
}
if (this.getJmesPath() != null) {
data.set("jmesPath", om.valueToTree(this.getJmesPath()));
}
if (this.getMethod() != null) {
data.set("method", om.valueToTree(this.getMethod()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@cdklabs/cdk-ecs-codedeploy.ApiTestStep"));
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;
ApiTestStep.Jsii$Proxy that = (ApiTestStep.Jsii$Proxy) o;
if (!name.equals(that.name)) return false;
if (!path.equals(that.path)) return false;
if (this.body != null ? !this.body.equals(that.body) : that.body != null) return false;
if (this.expectedValue != null ? !this.expectedValue.equals(that.expectedValue) : that.expectedValue != null) return false;
if (this.headers != null ? !this.headers.equals(that.headers) : that.headers != null) return false;
if (this.jmesPath != null ? !this.jmesPath.equals(that.jmesPath) : that.jmesPath != null) return false;
return this.method != null ? this.method.equals(that.method) : that.method == null;
}
@Override
public final int hashCode() {
int result = this.name.hashCode();
result = 31 * result + (this.path.hashCode());
result = 31 * result + (this.body != null ? this.body.hashCode() : 0);
result = 31 * result + (this.expectedValue != null ? this.expectedValue.hashCode() : 0);
result = 31 * result + (this.headers != null ? this.headers.hashCode() : 0);
result = 31 * result + (this.jmesPath != null ? this.jmesPath.hashCode() : 0);
result = 31 * result + (this.method != null ? this.method.hashCode() : 0);
return result;
}
}
}