Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.wisdom.model.AssistantAssociationData Maven / Gradle / Ivy
Go to download
The AWS Java SDK for Wisdom module holds the client classes that are used for
communicating with Wisdom.
/*
* 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.wisdom.model;
import java.io.Serializable;
import java.util.Arrays;
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 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.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Information about the assistant association.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AssistantAssociationData implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ASSISTANT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("assistantArn").getter(getter(AssistantAssociationData::assistantArn))
.setter(setter(Builder::assistantArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("assistantArn").build()).build();
private static final SdkField ASSISTANT_ASSOCIATION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("assistantAssociationArn").getter(getter(AssistantAssociationData::assistantAssociationArn))
.setter(setter(Builder::assistantAssociationArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("assistantAssociationArn").build())
.build();
private static final SdkField ASSISTANT_ASSOCIATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("assistantAssociationId").getter(getter(AssistantAssociationData::assistantAssociationId))
.setter(setter(Builder::assistantAssociationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("assistantAssociationId").build())
.build();
private static final SdkField ASSISTANT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("assistantId").getter(getter(AssistantAssociationData::assistantId)).setter(setter(Builder::assistantId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("assistantId").build()).build();
private static final SdkField ASSOCIATION_DATA_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("associationData")
.getter(getter(AssistantAssociationData::associationData)).setter(setter(Builder::associationData))
.constructor(AssistantAssociationOutputData::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("associationData").build()).build();
private static final SdkField ASSOCIATION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("associationType").getter(getter(AssistantAssociationData::associationTypeAsString))
.setter(setter(Builder::associationType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("associationType").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("tags")
.getter(getter(AssistantAssociationData::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ASSISTANT_ARN_FIELD,
ASSISTANT_ASSOCIATION_ARN_FIELD, ASSISTANT_ASSOCIATION_ID_FIELD, ASSISTANT_ID_FIELD, ASSOCIATION_DATA_FIELD,
ASSOCIATION_TYPE_FIELD, TAGS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String assistantArn;
private final String assistantAssociationArn;
private final String assistantAssociationId;
private final String assistantId;
private final AssistantAssociationOutputData associationData;
private final String associationType;
private final Map tags;
private AssistantAssociationData(BuilderImpl builder) {
this.assistantArn = builder.assistantArn;
this.assistantAssociationArn = builder.assistantAssociationArn;
this.assistantAssociationId = builder.assistantAssociationId;
this.assistantId = builder.assistantId;
this.associationData = builder.associationData;
this.associationType = builder.associationType;
this.tags = builder.tags;
}
/**
*
* The Amazon Resource Name (ARN) of the Wisdom assistant.
*
*
* @return The Amazon Resource Name (ARN) of the Wisdom assistant.
*/
public final String assistantArn() {
return assistantArn;
}
/**
*
* The Amazon Resource Name (ARN) of the assistant association.
*
*
* @return The Amazon Resource Name (ARN) of the assistant association.
*/
public final String assistantAssociationArn() {
return assistantAssociationArn;
}
/**
*
* The identifier of the assistant association.
*
*
* @return The identifier of the assistant association.
*/
public final String assistantAssociationId() {
return assistantAssociationId;
}
/**
*
* The identifier of the Wisdom assistant.
*
*
* @return The identifier of the Wisdom assistant.
*/
public final String assistantId() {
return assistantId;
}
/**
*
* A union type that currently has a single argument, the knowledge base ID.
*
*
* @return A union type that currently has a single argument, the knowledge base ID.
*/
public final AssistantAssociationOutputData associationData() {
return associationData;
}
/**
*
* The type of association.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #associationType}
* will return {@link AssociationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #associationTypeAsString}.
*
*
* @return The type of association.
* @see AssociationType
*/
public final AssociationType associationType() {
return AssociationType.fromValue(associationType);
}
/**
*
* The type of association.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #associationType}
* will return {@link AssociationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #associationTypeAsString}.
*
*
* @return The type of association.
* @see AssociationType
*/
public final String associationTypeAsString() {
return associationType;
}
/**
* For responses, this returns true if the service returned a value for the Tags 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 hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructMap);
}
/**
*
* The tags used to organize, track, or control access for this resource.
*
*
* 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 #hasTags} method.
*
*
* @return The tags used to organize, track, or control access for this resource.
*/
public final Map tags() {
return tags;
}
@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(assistantArn());
hashCode = 31 * hashCode + Objects.hashCode(assistantAssociationArn());
hashCode = 31 * hashCode + Objects.hashCode(assistantAssociationId());
hashCode = 31 * hashCode + Objects.hashCode(assistantId());
hashCode = 31 * hashCode + Objects.hashCode(associationData());
hashCode = 31 * hashCode + Objects.hashCode(associationTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
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 AssistantAssociationData)) {
return false;
}
AssistantAssociationData other = (AssistantAssociationData) obj;
return Objects.equals(assistantArn(), other.assistantArn())
&& Objects.equals(assistantAssociationArn(), other.assistantAssociationArn())
&& Objects.equals(assistantAssociationId(), other.assistantAssociationId())
&& Objects.equals(assistantId(), other.assistantId())
&& Objects.equals(associationData(), other.associationData())
&& Objects.equals(associationTypeAsString(), other.associationTypeAsString()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags());
}
/**
* 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("AssistantAssociationData").add("AssistantArn", assistantArn())
.add("AssistantAssociationArn", assistantAssociationArn())
.add("AssistantAssociationId", assistantAssociationId()).add("AssistantId", assistantId())
.add("AssociationData", associationData()).add("AssociationType", associationTypeAsString())
.add("Tags", hasTags() ? tags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "assistantArn":
return Optional.ofNullable(clazz.cast(assistantArn()));
case "assistantAssociationArn":
return Optional.ofNullable(clazz.cast(assistantAssociationArn()));
case "assistantAssociationId":
return Optional.ofNullable(clazz.cast(assistantAssociationId()));
case "assistantId":
return Optional.ofNullable(clazz.cast(assistantId()));
case "associationData":
return Optional.ofNullable(clazz.cast(associationData()));
case "associationType":
return Optional.ofNullable(clazz.cast(associationTypeAsString()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
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("assistantArn", ASSISTANT_ARN_FIELD);
map.put("assistantAssociationArn", ASSISTANT_ASSOCIATION_ARN_FIELD);
map.put("assistantAssociationId", ASSISTANT_ASSOCIATION_ID_FIELD);
map.put("assistantId", ASSISTANT_ID_FIELD);
map.put("associationData", ASSOCIATION_DATA_FIELD);
map.put("associationType", ASSOCIATION_TYPE_FIELD);
map.put("tags", TAGS_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function getter(Function g) {
return obj -> g.apply((AssistantAssociationData) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The Amazon Resource Name (ARN) of the Wisdom assistant.
*
*
* @param assistantArn
* The Amazon Resource Name (ARN) of the Wisdom assistant.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder assistantArn(String assistantArn);
/**
*
* The Amazon Resource Name (ARN) of the assistant association.
*
*
* @param assistantAssociationArn
* The Amazon Resource Name (ARN) of the assistant association.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder assistantAssociationArn(String assistantAssociationArn);
/**
*
* The identifier of the assistant association.
*
*
* @param assistantAssociationId
* The identifier of the assistant association.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder assistantAssociationId(String assistantAssociationId);
/**
*
* The identifier of the Wisdom assistant.
*
*
* @param assistantId
* The identifier of the Wisdom assistant.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder assistantId(String assistantId);
/**
*
* A union type that currently has a single argument, the knowledge base ID.
*
*
* @param associationData
* A union type that currently has a single argument, the knowledge base ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder associationData(AssistantAssociationOutputData associationData);
/**
*
* A union type that currently has a single argument, the knowledge base ID.
*
* This is a convenience method that creates an instance of the {@link AssistantAssociationOutputData.Builder}
* avoiding the need to create one manually via {@link AssistantAssociationOutputData#builder()}.
*
*
* When the {@link Consumer} completes, {@link AssistantAssociationOutputData.Builder#build()} is called
* immediately and its result is passed to {@link #associationData(AssistantAssociationOutputData)}.
*
* @param associationData
* a consumer that will call methods on {@link AssistantAssociationOutputData.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #associationData(AssistantAssociationOutputData)
*/
default Builder associationData(Consumer associationData) {
return associationData(AssistantAssociationOutputData.builder().applyMutation(associationData).build());
}
/**
*
* The type of association.
*
*
* @param associationType
* The type of association.
* @see AssociationType
* @return Returns a reference to this object so that method calls can be chained together.
* @see AssociationType
*/
Builder associationType(String associationType);
/**
*
* The type of association.
*
*
* @param associationType
* The type of association.
* @see AssociationType
* @return Returns a reference to this object so that method calls can be chained together.
* @see AssociationType
*/
Builder associationType(AssociationType associationType);
/**
*
* The tags used to organize, track, or control access for this resource.
*
*
* @param tags
* The tags used to organize, track, or control access for this resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Map tags);
}
static final class BuilderImpl implements Builder {
private String assistantArn;
private String assistantAssociationArn;
private String assistantAssociationId;
private String assistantId;
private AssistantAssociationOutputData associationData;
private String associationType;
private Map tags = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(AssistantAssociationData model) {
assistantArn(model.assistantArn);
assistantAssociationArn(model.assistantAssociationArn);
assistantAssociationId(model.assistantAssociationId);
assistantId(model.assistantId);
associationData(model.associationData);
associationType(model.associationType);
tags(model.tags);
}
public final String getAssistantArn() {
return assistantArn;
}
public final void setAssistantArn(String assistantArn) {
this.assistantArn = assistantArn;
}
@Override
public final Builder assistantArn(String assistantArn) {
this.assistantArn = assistantArn;
return this;
}
public final String getAssistantAssociationArn() {
return assistantAssociationArn;
}
public final void setAssistantAssociationArn(String assistantAssociationArn) {
this.assistantAssociationArn = assistantAssociationArn;
}
@Override
public final Builder assistantAssociationArn(String assistantAssociationArn) {
this.assistantAssociationArn = assistantAssociationArn;
return this;
}
public final String getAssistantAssociationId() {
return assistantAssociationId;
}
public final void setAssistantAssociationId(String assistantAssociationId) {
this.assistantAssociationId = assistantAssociationId;
}
@Override
public final Builder assistantAssociationId(String assistantAssociationId) {
this.assistantAssociationId = assistantAssociationId;
return this;
}
public final String getAssistantId() {
return assistantId;
}
public final void setAssistantId(String assistantId) {
this.assistantId = assistantId;
}
@Override
public final Builder assistantId(String assistantId) {
this.assistantId = assistantId;
return this;
}
public final AssistantAssociationOutputData.Builder getAssociationData() {
return associationData != null ? associationData.toBuilder() : null;
}
public final void setAssociationData(AssistantAssociationOutputData.BuilderImpl associationData) {
this.associationData = associationData != null ? associationData.build() : null;
}
@Override
public final Builder associationData(AssistantAssociationOutputData associationData) {
this.associationData = associationData;
return this;
}
public final String getAssociationType() {
return associationType;
}
public final void setAssociationType(String associationType) {
this.associationType = associationType;
}
@Override
public final Builder associationType(String associationType) {
this.associationType = associationType;
return this;
}
@Override
public final Builder associationType(AssociationType associationType) {
this.associationType(associationType == null ? null : associationType.toString());
return this;
}
public final Map getTags() {
if (tags instanceof SdkAutoConstructMap) {
return null;
}
return tags;
}
public final void setTags(Map tags) {
this.tags = TagsCopier.copy(tags);
}
@Override
public final Builder tags(Map tags) {
this.tags = TagsCopier.copy(tags);
return this;
}
@Override
public AssistantAssociationData build() {
return new AssistantAssociationData(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}