software.amazon.awssdk.services.opensearch.model.AdvancedSecurityOptionsInput Maven / Gradle / Ivy
/*
* 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.opensearch.model;
import java.io.Serializable;
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.Consumer;
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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The advanced security configuration: whether advanced security is enabled, whether the internal database option is
* enabled, master username and password (if internal database is enabled), and master user ARN (if IAM is enabled).
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AdvancedSecurityOptionsInput implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("Enabled").getter(getter(AdvancedSecurityOptionsInput::enabled)).setter(setter(Builder::enabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Enabled").build()).build();
private static final SdkField INTERNAL_USER_DATABASE_ENABLED_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("InternalUserDatabaseEnabled")
.getter(getter(AdvancedSecurityOptionsInput::internalUserDatabaseEnabled))
.setter(setter(Builder::internalUserDatabaseEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InternalUserDatabaseEnabled")
.build()).build();
private static final SdkField MASTER_USER_OPTIONS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("MasterUserOptions")
.getter(getter(AdvancedSecurityOptionsInput::masterUserOptions)).setter(setter(Builder::masterUserOptions))
.constructor(MasterUserOptions::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MasterUserOptions").build()).build();
private static final SdkField SAML_OPTIONS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("SAMLOptions")
.getter(getter(AdvancedSecurityOptionsInput::samlOptions)).setter(setter(Builder::samlOptions))
.constructor(SAMLOptionsInput::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SAMLOptions").build()).build();
private static final SdkField ANONYMOUS_AUTH_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("AnonymousAuthEnabled").getter(getter(AdvancedSecurityOptionsInput::anonymousAuthEnabled))
.setter(setter(Builder::anonymousAuthEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AnonymousAuthEnabled").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ENABLED_FIELD,
INTERNAL_USER_DATABASE_ENABLED_FIELD, MASTER_USER_OPTIONS_FIELD, SAML_OPTIONS_FIELD, ANONYMOUS_AUTH_ENABLED_FIELD));
private static final long serialVersionUID = 1L;
private final Boolean enabled;
private final Boolean internalUserDatabaseEnabled;
private final MasterUserOptions masterUserOptions;
private final SAMLOptionsInput samlOptions;
private final Boolean anonymousAuthEnabled;
private AdvancedSecurityOptionsInput(BuilderImpl builder) {
this.enabled = builder.enabled;
this.internalUserDatabaseEnabled = builder.internalUserDatabaseEnabled;
this.masterUserOptions = builder.masterUserOptions;
this.samlOptions = builder.samlOptions;
this.anonymousAuthEnabled = builder.anonymousAuthEnabled;
}
/**
*
* True if advanced security is enabled.
*
*
* @return True if advanced security is enabled.
*/
public final Boolean enabled() {
return enabled;
}
/**
*
* True if the internal user database is enabled.
*
*
* @return True if the internal user database is enabled.
*/
public final Boolean internalUserDatabaseEnabled() {
return internalUserDatabaseEnabled;
}
/**
*
* Credentials for the master user: username and password, ARN, or both.
*
*
* @return Credentials for the master user: username and password, ARN, or both.
*/
public final MasterUserOptions masterUserOptions() {
return masterUserOptions;
}
/**
*
* The SAML application configuration for the domain.
*
*
* @return The SAML application configuration for the domain.
*/
public final SAMLOptionsInput samlOptions() {
return samlOptions;
}
/**
*
* True if Anonymous auth is enabled. Anonymous auth can be enabled only when AdvancedSecurity is enabled on
* existing domains.
*
*
* @return True if Anonymous auth is enabled. Anonymous auth can be enabled only when AdvancedSecurity is enabled on
* existing domains.
*/
public final Boolean anonymousAuthEnabled() {
return anonymousAuthEnabled;
}
@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(enabled());
hashCode = 31 * hashCode + Objects.hashCode(internalUserDatabaseEnabled());
hashCode = 31 * hashCode + Objects.hashCode(masterUserOptions());
hashCode = 31 * hashCode + Objects.hashCode(samlOptions());
hashCode = 31 * hashCode + Objects.hashCode(anonymousAuthEnabled());
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 AdvancedSecurityOptionsInput)) {
return false;
}
AdvancedSecurityOptionsInput other = (AdvancedSecurityOptionsInput) obj;
return Objects.equals(enabled(), other.enabled())
&& Objects.equals(internalUserDatabaseEnabled(), other.internalUserDatabaseEnabled())
&& Objects.equals(masterUserOptions(), other.masterUserOptions())
&& Objects.equals(samlOptions(), other.samlOptions())
&& Objects.equals(anonymousAuthEnabled(), other.anonymousAuthEnabled());
}
/**
* 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("AdvancedSecurityOptionsInput").add("Enabled", enabled())
.add("InternalUserDatabaseEnabled", internalUserDatabaseEnabled()).add("MasterUserOptions", masterUserOptions())
.add("SAMLOptions", samlOptions()).add("AnonymousAuthEnabled", anonymousAuthEnabled()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Enabled":
return Optional.ofNullable(clazz.cast(enabled()));
case "InternalUserDatabaseEnabled":
return Optional.ofNullable(clazz.cast(internalUserDatabaseEnabled()));
case "MasterUserOptions":
return Optional.ofNullable(clazz.cast(masterUserOptions()));
case "SAMLOptions":
return Optional.ofNullable(clazz.cast(samlOptions()));
case "AnonymousAuthEnabled":
return Optional.ofNullable(clazz.cast(anonymousAuthEnabled()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy