software.amazon.awssdk.services.mq.model.BrokerSummary Maven / Gradle / Ivy
Show all versions of mq Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.mq.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Returns information about all brokers.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class BrokerSummary implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField BROKER_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BrokerArn").getter(getter(BrokerSummary::brokerArn)).setter(setter(Builder::brokerArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("brokerArn").build()).build();
private static final SdkField BROKER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BrokerId").getter(getter(BrokerSummary::brokerId)).setter(setter(Builder::brokerId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("brokerId").build()).build();
private static final SdkField BROKER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BrokerName").getter(getter(BrokerSummary::brokerName)).setter(setter(Builder::brokerName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("brokerName").build()).build();
private static final SdkField BROKER_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BrokerState").getter(getter(BrokerSummary::brokerStateAsString)).setter(setter(Builder::brokerState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("brokerState").build()).build();
private static final SdkField CREATED_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("Created")
.getter(getter(BrokerSummary::created))
.setter(setter(Builder::created))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("created").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField DEPLOYMENT_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DeploymentMode").getter(getter(BrokerSummary::deploymentModeAsString))
.setter(setter(Builder::deploymentMode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentMode").build()).build();
private static final SdkField ENGINE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EngineType").getter(getter(BrokerSummary::engineTypeAsString)).setter(setter(Builder::engineType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("engineType").build()).build();
private static final SdkField HOST_INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("HostInstanceType").getter(getter(BrokerSummary::hostInstanceType))
.setter(setter(Builder::hostInstanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("hostInstanceType").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BROKER_ARN_FIELD,
BROKER_ID_FIELD, BROKER_NAME_FIELD, BROKER_STATE_FIELD, CREATED_FIELD, DEPLOYMENT_MODE_FIELD, ENGINE_TYPE_FIELD,
HOST_INSTANCE_TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final String brokerArn;
private final String brokerId;
private final String brokerName;
private final String brokerState;
private final Instant created;
private final String deploymentMode;
private final String engineType;
private final String hostInstanceType;
private BrokerSummary(BuilderImpl builder) {
this.brokerArn = builder.brokerArn;
this.brokerId = builder.brokerId;
this.brokerName = builder.brokerName;
this.brokerState = builder.brokerState;
this.created = builder.created;
this.deploymentMode = builder.deploymentMode;
this.engineType = builder.engineType;
this.hostInstanceType = builder.hostInstanceType;
}
/**
*
* The broker's Amazon Resource Name (ARN).
*
*
* @return The broker's Amazon Resource Name (ARN).
*/
public final String brokerArn() {
return brokerArn;
}
/**
*
* The unique ID that Amazon MQ generates for the broker.
*
*
* @return The unique ID that Amazon MQ generates for the broker.
*/
public final String brokerId() {
return brokerId;
}
/**
*
* The broker's name. This value is unique in your Amazon Web Services account, 1-50 characters long, and containing
* only letters, numbers, dashes, and underscores, and must not contain white spaces, brackets, wildcard characters,
* or special characters.
*
*
* @return The broker's name. This value is unique in your Amazon Web Services account, 1-50 characters long, and
* containing only letters, numbers, dashes, and underscores, and must not contain white spaces, brackets,
* wildcard characters, or special characters.
*/
public final String brokerName() {
return brokerName;
}
/**
*
* The broker's status.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #brokerState} will
* return {@link BrokerState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #brokerStateAsString}.
*
*
* @return The broker's status.
* @see BrokerState
*/
public final BrokerState brokerState() {
return BrokerState.fromValue(brokerState);
}
/**
*
* The broker's status.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #brokerState} will
* return {@link BrokerState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #brokerStateAsString}.
*
*
* @return The broker's status.
* @see BrokerState
*/
public final String brokerStateAsString() {
return brokerState;
}
/**
*
* The time when the broker was created.
*
*
* @return The time when the broker was created.
*/
public final Instant created() {
return created;
}
/**
*
* The broker's deployment mode.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #deploymentMode}
* will return {@link DeploymentMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #deploymentModeAsString}.
*
*
* @return The broker's deployment mode.
* @see DeploymentMode
*/
public final DeploymentMode deploymentMode() {
return DeploymentMode.fromValue(deploymentMode);
}
/**
*
* The broker's deployment mode.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #deploymentMode}
* will return {@link DeploymentMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #deploymentModeAsString}.
*
*
* @return The broker's deployment mode.
* @see DeploymentMode
*/
public final String deploymentModeAsString() {
return deploymentMode;
}
/**
*
* The type of broker engine.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #engineType} will
* return {@link EngineType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #engineTypeAsString}.
*
*
* @return The type of broker engine.
* @see EngineType
*/
public final EngineType engineType() {
return EngineType.fromValue(engineType);
}
/**
*
* The type of broker engine.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #engineType} will
* return {@link EngineType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #engineTypeAsString}.
*
*
* @return The type of broker engine.
* @see EngineType
*/
public final String engineTypeAsString() {
return engineType;
}
/**
*
* The broker's instance type.
*
*
* @return The broker's instance type.
*/
public final String hostInstanceType() {
return hostInstanceType;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(brokerArn());
hashCode = 31 * hashCode + Objects.hashCode(brokerId());
hashCode = 31 * hashCode + Objects.hashCode(brokerName());
hashCode = 31 * hashCode + Objects.hashCode(brokerStateAsString());
hashCode = 31 * hashCode + Objects.hashCode(created());
hashCode = 31 * hashCode + Objects.hashCode(deploymentModeAsString());
hashCode = 31 * hashCode + Objects.hashCode(engineTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(hostInstanceType());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof BrokerSummary)) {
return false;
}
BrokerSummary other = (BrokerSummary) obj;
return Objects.equals(brokerArn(), other.brokerArn()) && Objects.equals(brokerId(), other.brokerId())
&& Objects.equals(brokerName(), other.brokerName())
&& Objects.equals(brokerStateAsString(), other.brokerStateAsString())
&& Objects.equals(created(), other.created())
&& Objects.equals(deploymentModeAsString(), other.deploymentModeAsString())
&& Objects.equals(engineTypeAsString(), other.engineTypeAsString())
&& Objects.equals(hostInstanceType(), other.hostInstanceType());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("BrokerSummary").add("BrokerArn", brokerArn()).add("BrokerId", brokerId())
.add("BrokerName", brokerName()).add("BrokerState", brokerStateAsString()).add("Created", created())
.add("DeploymentMode", deploymentModeAsString()).add("EngineType", engineTypeAsString())
.add("HostInstanceType", hostInstanceType()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BrokerArn":
return Optional.ofNullable(clazz.cast(brokerArn()));
case "BrokerId":
return Optional.ofNullable(clazz.cast(brokerId()));
case "BrokerName":
return Optional.ofNullable(clazz.cast(brokerName()));
case "BrokerState":
return Optional.ofNullable(clazz.cast(brokerStateAsString()));
case "Created":
return Optional.ofNullable(clazz.cast(created()));
case "DeploymentMode":
return Optional.ofNullable(clazz.cast(deploymentModeAsString()));
case "EngineType":
return Optional.ofNullable(clazz.cast(engineTypeAsString()));
case "HostInstanceType":
return Optional.ofNullable(clazz.cast(hostInstanceType()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function