software.amazon.awssdk.services.mq.model.UpdateBrokerRequest 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.util.Arrays;
import java.util.Collection;
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.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Updates the broker using the specified properties.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateBrokerRequest extends MqRequest implements
ToCopyableBuilder {
private static final SdkField AUTHENTICATION_STRATEGY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AuthenticationStrategy").getter(getter(UpdateBrokerRequest::authenticationStrategyAsString))
.setter(setter(Builder::authenticationStrategy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("authenticationStrategy").build())
.build();
private static final SdkField AUTO_MINOR_VERSION_UPGRADE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("AutoMinorVersionUpgrade").getter(getter(UpdateBrokerRequest::autoMinorVersionUpgrade))
.setter(setter(Builder::autoMinorVersionUpgrade))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("autoMinorVersionUpgrade").build())
.build();
private static final SdkField BROKER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BrokerId").getter(getter(UpdateBrokerRequest::brokerId)).setter(setter(Builder::brokerId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("broker-id").build()).build();
private static final SdkField CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Configuration")
.getter(getter(UpdateBrokerRequest::configuration)).setter(setter(Builder::configuration))
.constructor(ConfigurationId::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("configuration").build()).build();
private static final SdkField ENGINE_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EngineVersion").getter(getter(UpdateBrokerRequest::engineVersion))
.setter(setter(Builder::engineVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("engineVersion").build()).build();
private static final SdkField HOST_INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("HostInstanceType").getter(getter(UpdateBrokerRequest::hostInstanceType))
.setter(setter(Builder::hostInstanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("hostInstanceType").build()).build();
private static final SdkField LDAP_SERVER_METADATA_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("LdapServerMetadata")
.getter(getter(UpdateBrokerRequest::ldapServerMetadata)).setter(setter(Builder::ldapServerMetadata))
.constructor(LdapServerMetadataInput::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ldapServerMetadata").build())
.build();
private static final SdkField LOGS_FIELD = SdkField. builder(MarshallingType.SDK_POJO).memberName("Logs")
.getter(getter(UpdateBrokerRequest::logs)).setter(setter(Builder::logs)).constructor(Logs::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("logs").build()).build();
private static final SdkField MAINTENANCE_WINDOW_START_TIME_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("MaintenanceWindowStartTime")
.getter(getter(UpdateBrokerRequest::maintenanceWindowStartTime))
.setter(setter(Builder::maintenanceWindowStartTime))
.constructor(WeeklyStartTime::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("maintenanceWindowStartTime").build())
.build();
private static final SdkField> SECURITY_GROUPS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("SecurityGroups")
.getter(getter(UpdateBrokerRequest::securityGroups))
.setter(setter(Builder::securityGroups))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("securityGroups").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField DATA_REPLICATION_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DataReplicationMode").getter(getter(UpdateBrokerRequest::dataReplicationModeAsString))
.setter(setter(Builder::dataReplicationMode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dataReplicationMode").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUTHENTICATION_STRATEGY_FIELD,
AUTO_MINOR_VERSION_UPGRADE_FIELD, BROKER_ID_FIELD, CONFIGURATION_FIELD, ENGINE_VERSION_FIELD,
HOST_INSTANCE_TYPE_FIELD, LDAP_SERVER_METADATA_FIELD, LOGS_FIELD, MAINTENANCE_WINDOW_START_TIME_FIELD,
SECURITY_GROUPS_FIELD, DATA_REPLICATION_MODE_FIELD));
private final String authenticationStrategy;
private final Boolean autoMinorVersionUpgrade;
private final String brokerId;
private final ConfigurationId configuration;
private final String engineVersion;
private final String hostInstanceType;
private final LdapServerMetadataInput ldapServerMetadata;
private final Logs logs;
private final WeeklyStartTime maintenanceWindowStartTime;
private final List securityGroups;
private final String dataReplicationMode;
private UpdateBrokerRequest(BuilderImpl builder) {
super(builder);
this.authenticationStrategy = builder.authenticationStrategy;
this.autoMinorVersionUpgrade = builder.autoMinorVersionUpgrade;
this.brokerId = builder.brokerId;
this.configuration = builder.configuration;
this.engineVersion = builder.engineVersion;
this.hostInstanceType = builder.hostInstanceType;
this.ldapServerMetadata = builder.ldapServerMetadata;
this.logs = builder.logs;
this.maintenanceWindowStartTime = builder.maintenanceWindowStartTime;
this.securityGroups = builder.securityGroups;
this.dataReplicationMode = builder.dataReplicationMode;
}
/**
*
* Optional. The authentication strategy used to secure the broker. The default is SIMPLE.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #authenticationStrategy} will return {@link AuthenticationStrategy#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #authenticationStrategyAsString}.
*
*
* @return Optional. The authentication strategy used to secure the broker. The default is SIMPLE.
* @see AuthenticationStrategy
*/
public final AuthenticationStrategy authenticationStrategy() {
return AuthenticationStrategy.fromValue(authenticationStrategy);
}
/**
*
* Optional. The authentication strategy used to secure the broker. The default is SIMPLE.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #authenticationStrategy} will return {@link AuthenticationStrategy#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #authenticationStrategyAsString}.
*
*
* @return Optional. The authentication strategy used to secure the broker. The default is SIMPLE.
* @see AuthenticationStrategy
*/
public final String authenticationStrategyAsString() {
return authenticationStrategy;
}
/**
*
* Enables automatic upgrades to new patch versions for brokers as new versions are released and supported by Amazon
* MQ. Automatic upgrades occur during the scheduled maintenance window or after a manual broker reboot.
*
*
*
* Must be set to true for ActiveMQ brokers version 5.18 and above and for RabbitMQ brokers version 3.13 and above.
*
*
*
* @return Enables automatic upgrades to new patch versions for brokers as new versions are released and supported
* by Amazon MQ. Automatic upgrades occur during the scheduled maintenance window or after a manual broker
* reboot.
*
* Must be set to true for ActiveMQ brokers version 5.18 and above and for RabbitMQ brokers version 3.13 and
* above.
*
*/
public final Boolean autoMinorVersionUpgrade() {
return autoMinorVersionUpgrade;
}
/**
*
* 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;
}
/**
*
* A list of information about the configuration.
*
*
* @return A list of information about the configuration.
*/
public final ConfigurationId configuration() {
return configuration;
}
/**
*
* The broker engine version. For more information, see the ActiveMQ
* version management and the RabbitMQ
* version management sections in the Amazon MQ Developer Guide.
*
*
*
* When upgrading to ActiveMQ version 5.18 and above or RabbitMQ version 3.13 and above, you must have
* autoMinorVersionUpgrade set to true for the broker.
*
*
*
* @return The broker engine version. For more information, see the ActiveMQ version management and the RabbitMQ version management sections in the Amazon MQ Developer Guide.
*
* When upgrading to ActiveMQ version 5.18 and above or RabbitMQ version 3.13 and above, you must have
* autoMinorVersionUpgrade set to true for the broker.
*
*/
public final String engineVersion() {
return engineVersion;
}
/**
*
* The broker's host instance type to upgrade to. For a list of supported instance types, see Broker
* instance types.
*
*
* @return The broker's host instance type to upgrade to. For a list of supported instance types, see Broker instance types.
*/
public final String hostInstanceType() {
return hostInstanceType;
}
/**
*
* Optional. The metadata of the LDAP server used to authenticate and authorize connections to the broker. Does not
* apply to RabbitMQ brokers.
*
*
* @return Optional. The metadata of the LDAP server used to authenticate and authorize connections to the broker.
* Does not apply to RabbitMQ brokers.
*/
public final LdapServerMetadataInput ldapServerMetadata() {
return ldapServerMetadata;
}
/**
*
* Enables Amazon CloudWatch logging for brokers.
*
*
* @return Enables Amazon CloudWatch logging for brokers.
*/
public final Logs logs() {
return logs;
}
/**
*
* The parameters that determine the WeeklyStartTime.
*
*
* @return The parameters that determine the WeeklyStartTime.
*/
public final WeeklyStartTime maintenanceWindowStartTime() {
return maintenanceWindowStartTime;
}
/**
* For responses, this returns true if the service returned a value for the SecurityGroups property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasSecurityGroups() {
return securityGroups != null && !(securityGroups instanceof SdkAutoConstructList);
}
/**
*
* The list of security groups (1 minimum, 5 maximum) that authorizes connections to brokers.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasSecurityGroups} method.
*
*
* @return The list of security groups (1 minimum, 5 maximum) that authorizes connections to brokers.
*/
public final List securityGroups() {
return securityGroups;
}
/**
*
* Defines whether this broker is a part of a data replication pair.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dataReplicationMode} will return {@link DataReplicationMode#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #dataReplicationModeAsString}.
*
*
* @return Defines whether this broker is a part of a data replication pair.
* @see DataReplicationMode
*/
public final DataReplicationMode dataReplicationMode() {
return DataReplicationMode.fromValue(dataReplicationMode);
}
/**
*
* Defines whether this broker is a part of a data replication pair.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dataReplicationMode} will return {@link DataReplicationMode#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #dataReplicationModeAsString}.
*
*
* @return Defines whether this broker is a part of a data replication pair.
* @see DataReplicationMode
*/
public final String dataReplicationModeAsString() {
return dataReplicationMode;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(authenticationStrategyAsString());
hashCode = 31 * hashCode + Objects.hashCode(autoMinorVersionUpgrade());
hashCode = 31 * hashCode + Objects.hashCode(brokerId());
hashCode = 31 * hashCode + Objects.hashCode(configuration());
hashCode = 31 * hashCode + Objects.hashCode(engineVersion());
hashCode = 31 * hashCode + Objects.hashCode(hostInstanceType());
hashCode = 31 * hashCode + Objects.hashCode(ldapServerMetadata());
hashCode = 31 * hashCode + Objects.hashCode(logs());
hashCode = 31 * hashCode + Objects.hashCode(maintenanceWindowStartTime());
hashCode = 31 * hashCode + Objects.hashCode(hasSecurityGroups() ? securityGroups() : null);
hashCode = 31 * hashCode + Objects.hashCode(dataReplicationModeAsString());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof UpdateBrokerRequest)) {
return false;
}
UpdateBrokerRequest other = (UpdateBrokerRequest) obj;
return Objects.equals(authenticationStrategyAsString(), other.authenticationStrategyAsString())
&& Objects.equals(autoMinorVersionUpgrade(), other.autoMinorVersionUpgrade())
&& Objects.equals(brokerId(), other.brokerId()) && Objects.equals(configuration(), other.configuration())
&& Objects.equals(engineVersion(), other.engineVersion())
&& Objects.equals(hostInstanceType(), other.hostInstanceType())
&& Objects.equals(ldapServerMetadata(), other.ldapServerMetadata()) && Objects.equals(logs(), other.logs())
&& Objects.equals(maintenanceWindowStartTime(), other.maintenanceWindowStartTime())
&& hasSecurityGroups() == other.hasSecurityGroups() && Objects.equals(securityGroups(), other.securityGroups())
&& Objects.equals(dataReplicationModeAsString(), other.dataReplicationModeAsString());
}
/**
* 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("UpdateBrokerRequest").add("AuthenticationStrategy", authenticationStrategyAsString())
.add("AutoMinorVersionUpgrade", autoMinorVersionUpgrade()).add("BrokerId", brokerId())
.add("Configuration", configuration()).add("EngineVersion", engineVersion())
.add("HostInstanceType", hostInstanceType()).add("LdapServerMetadata", ldapServerMetadata()).add("Logs", logs())
.add("MaintenanceWindowStartTime", maintenanceWindowStartTime())
.add("SecurityGroups", hasSecurityGroups() ? securityGroups() : null)
.add("DataReplicationMode", dataReplicationModeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AuthenticationStrategy":
return Optional.ofNullable(clazz.cast(authenticationStrategyAsString()));
case "AutoMinorVersionUpgrade":
return Optional.ofNullable(clazz.cast(autoMinorVersionUpgrade()));
case "BrokerId":
return Optional.ofNullable(clazz.cast(brokerId()));
case "Configuration":
return Optional.ofNullable(clazz.cast(configuration()));
case "EngineVersion":
return Optional.ofNullable(clazz.cast(engineVersion()));
case "HostInstanceType":
return Optional.ofNullable(clazz.cast(hostInstanceType()));
case "LdapServerMetadata":
return Optional.ofNullable(clazz.cast(ldapServerMetadata()));
case "Logs":
return Optional.ofNullable(clazz.cast(logs()));
case "MaintenanceWindowStartTime":
return Optional.ofNullable(clazz.cast(maintenanceWindowStartTime()));
case "SecurityGroups":
return Optional.ofNullable(clazz.cast(securityGroups()));
case "DataReplicationMode":
return Optional.ofNullable(clazz.cast(dataReplicationModeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function