software.amazon.awssdk.services.opensearch.model.CreateApplicationResponse Maven / Gradle / Ivy
Show all versions of opensearch 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.opensearch.model;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateApplicationResponse extends OpenSearchResponse implements
ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("id")
.getter(getter(CreateApplicationResponse::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("id").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(CreateApplicationResponse::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(CreateApplicationResponse::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField> DATA_SOURCES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("dataSources")
.getter(getter(CreateApplicationResponse::dataSources))
.setter(setter(Builder::dataSources))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dataSources").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(DataSource::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField IAM_IDENTITY_CENTER_OPTIONS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("iamIdentityCenterOptions")
.getter(getter(CreateApplicationResponse::iamIdentityCenterOptions))
.setter(setter(Builder::iamIdentityCenterOptions)).constructor(IamIdentityCenterOptions::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("iamIdentityCenterOptions").build())
.build();
private static final SdkField> APP_CONFIGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("appConfigs")
.getter(getter(CreateApplicationResponse::appConfigs))
.setter(setter(Builder::appConfigs))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("appConfigs").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AppConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> TAG_LIST_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("tagList")
.getter(getter(CreateApplicationResponse::tagList))
.setter(setter(Builder::tagList))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tagList").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("createdAt").getter(getter(CreateApplicationResponse::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdAt").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays
.asList(ID_FIELD, NAME_FIELD, ARN_FIELD, DATA_SOURCES_FIELD, IAM_IDENTITY_CENTER_OPTIONS_FIELD, APP_CONFIGS_FIELD,
TAG_LIST_FIELD, CREATED_AT_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private final String id;
private final String name;
private final String arn;
private final List dataSources;
private final IamIdentityCenterOptions iamIdentityCenterOptions;
private final List appConfigs;
private final List tagList;
private final Instant createdAt;
private CreateApplicationResponse(BuilderImpl builder) {
super(builder);
this.id = builder.id;
this.name = builder.name;
this.arn = builder.arn;
this.dataSources = builder.dataSources;
this.iamIdentityCenterOptions = builder.iamIdentityCenterOptions;
this.appConfigs = builder.appConfigs;
this.tagList = builder.tagList;
this.createdAt = builder.createdAt;
}
/**
*
* Unique identifier for the created OpenSearch Application.
*
*
* @return Unique identifier for the created OpenSearch Application.
*/
public final String id() {
return id;
}
/**
*
* Name of the created OpenSearch Application.
*
*
* @return Name of the created OpenSearch Application.
*/
public final String name() {
return name;
}
/**
* Returns the value of the Arn property for this object.
*
* @return The value of the Arn property for this object.
*/
public final String arn() {
return arn;
}
/**
* For responses, this returns true if the service returned a value for the DataSources 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 hasDataSources() {
return dataSources != null && !(dataSources instanceof SdkAutoConstructList);
}
/**
*
* Data sources associated with the created OpenSearch Application.
*
*
* 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 #hasDataSources} method.
*
*
* @return Data sources associated with the created OpenSearch Application.
*/
public final List dataSources() {
return dataSources;
}
/**
*
* Settings of IAM Identity Center for the created OpenSearch Application.
*
*
* @return Settings of IAM Identity Center for the created OpenSearch Application.
*/
public final IamIdentityCenterOptions iamIdentityCenterOptions() {
return iamIdentityCenterOptions;
}
/**
* For responses, this returns true if the service returned a value for the AppConfigs 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 hasAppConfigs() {
return appConfigs != null && !(appConfigs instanceof SdkAutoConstructList);
}
/**
*
* Configurations of the OpenSearch Application, inlcuding admin configuration.
*
*
* 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 #hasAppConfigs} method.
*
*
* @return Configurations of the OpenSearch Application, inlcuding admin configuration.
*/
public final List appConfigs() {
return appConfigs;
}
/**
* For responses, this returns true if the service returned a value for the TagList 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 hasTagList() {
return tagList != null && !(tagList instanceof SdkAutoConstructList);
}
/**
* Returns the value of the TagList property for this object.
*
* 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 #hasTagList} method.
*
*
* @return The value of the TagList property for this object.
*/
public final List tagList() {
return tagList;
}
/**
*
* Timestamp when the OpenSearch Application was created.
*
*
* @return Timestamp when the OpenSearch Application was created.
*/
public final Instant createdAt() {
return createdAt;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(hasDataSources() ? dataSources() : null);
hashCode = 31 * hashCode + Objects.hashCode(iamIdentityCenterOptions());
hashCode = 31 * hashCode + Objects.hashCode(hasAppConfigs() ? appConfigs() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasTagList() ? tagList() : null);
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
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 CreateApplicationResponse)) {
return false;
}
CreateApplicationResponse other = (CreateApplicationResponse) obj;
return Objects.equals(id(), other.id()) && Objects.equals(name(), other.name()) && Objects.equals(arn(), other.arn())
&& hasDataSources() == other.hasDataSources() && Objects.equals(dataSources(), other.dataSources())
&& Objects.equals(iamIdentityCenterOptions(), other.iamIdentityCenterOptions())
&& hasAppConfigs() == other.hasAppConfigs() && Objects.equals(appConfigs(), other.appConfigs())
&& hasTagList() == other.hasTagList() && Objects.equals(tagList(), other.tagList())
&& Objects.equals(createdAt(), other.createdAt());
}
/**
* 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("CreateApplicationResponse").add("Id", id()).add("Name", name()).add("Arn", arn())
.add("DataSources", hasDataSources() ? dataSources() : null)
.add("IamIdentityCenterOptions", iamIdentityCenterOptions())
.add("AppConfigs", hasAppConfigs() ? appConfigs() : null).add("TagList", hasTagList() ? tagList() : null)
.add("CreatedAt", createdAt()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "id":
return Optional.ofNullable(clazz.cast(id()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "dataSources":
return Optional.ofNullable(clazz.cast(dataSources()));
case "iamIdentityCenterOptions":
return Optional.ofNullable(clazz.cast(iamIdentityCenterOptions()));
case "appConfigs":
return Optional.ofNullable(clazz.cast(appConfigs()));
case "tagList":
return Optional.ofNullable(clazz.cast(tagList()));
case "createdAt":
return Optional.ofNullable(clazz.cast(createdAt()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("id", ID_FIELD);
map.put("name", NAME_FIELD);
map.put("arn", ARN_FIELD);
map.put("dataSources", DATA_SOURCES_FIELD);
map.put("iamIdentityCenterOptions", IAM_IDENTITY_CENTER_OPTIONS_FIELD);
map.put("appConfigs", APP_CONFIGS_FIELD);
map.put("tagList", TAG_LIST_FIELD);
map.put("createdAt", CREATED_AT_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function