software.amazon.awssdk.services.cleanrooms.model.Membership Maven / Gradle / Ivy
Show all versions of cleanrooms 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.cleanrooms.model;
import java.io.Serializable;
import java.time.Instant;
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.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;
/**
*
* The membership object.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Membership implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("id")
.getter(getter(Membership::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("id").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(Membership::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField COLLABORATION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("collaborationArn").getter(getter(Membership::collaborationArn))
.setter(setter(Builder::collaborationArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("collaborationArn").build()).build();
private static final SdkField COLLABORATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("collaborationId").getter(getter(Membership::collaborationId)).setter(setter(Builder::collaborationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("collaborationId").build()).build();
private static final SdkField COLLABORATION_CREATOR_ACCOUNT_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("collaborationCreatorAccountId")
.getter(getter(Membership::collaborationCreatorAccountId))
.setter(setter(Builder::collaborationCreatorAccountId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("collaborationCreatorAccountId")
.build()).build();
private static final SdkField COLLABORATION_CREATOR_DISPLAY_NAME_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("collaborationCreatorDisplayName")
.getter(getter(Membership::collaborationCreatorDisplayName))
.setter(setter(Builder::collaborationCreatorDisplayName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("collaborationCreatorDisplayName")
.build()).build();
private static final SdkField COLLABORATION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("collaborationName").getter(getter(Membership::collaborationName))
.setter(setter(Builder::collaborationName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("collaborationName").build()).build();
private static final SdkField CREATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("createTime").getter(getter(Membership::createTime)).setter(setter(Builder::createTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createTime").build()).build();
private static final SdkField UPDATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("updateTime").getter(getter(Membership::updateTime)).setter(setter(Builder::updateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("updateTime").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(Membership::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField> MEMBER_ABILITIES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("memberAbilities")
.getter(getter(Membership::memberAbilitiesAsStrings))
.setter(setter(Builder::memberAbilitiesWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("memberAbilities").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 QUERY_LOG_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("queryLogStatus").getter(getter(Membership::queryLogStatusAsString))
.setter(setter(Builder::queryLogStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("queryLogStatus").build()).build();
private static final SdkField DEFAULT_RESULT_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("defaultResultConfiguration")
.getter(getter(Membership::defaultResultConfiguration))
.setter(setter(Builder::defaultResultConfiguration))
.constructor(MembershipProtectedQueryResultConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("defaultResultConfiguration").build())
.build();
private static final SdkField PAYMENT_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("paymentConfiguration")
.getter(getter(Membership::paymentConfiguration)).setter(setter(Builder::paymentConfiguration))
.constructor(MembershipPaymentConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("paymentConfiguration").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, ARN_FIELD,
COLLABORATION_ARN_FIELD, COLLABORATION_ID_FIELD, COLLABORATION_CREATOR_ACCOUNT_ID_FIELD,
COLLABORATION_CREATOR_DISPLAY_NAME_FIELD, COLLABORATION_NAME_FIELD, CREATE_TIME_FIELD, UPDATE_TIME_FIELD,
STATUS_FIELD, MEMBER_ABILITIES_FIELD, QUERY_LOG_STATUS_FIELD, DEFAULT_RESULT_CONFIGURATION_FIELD,
PAYMENT_CONFIGURATION_FIELD));
private static final long serialVersionUID = 1L;
private final String id;
private final String arn;
private final String collaborationArn;
private final String collaborationId;
private final String collaborationCreatorAccountId;
private final String collaborationCreatorDisplayName;
private final String collaborationName;
private final Instant createTime;
private final Instant updateTime;
private final String status;
private final List memberAbilities;
private final String queryLogStatus;
private final MembershipProtectedQueryResultConfiguration defaultResultConfiguration;
private final MembershipPaymentConfiguration paymentConfiguration;
private Membership(BuilderImpl builder) {
this.id = builder.id;
this.arn = builder.arn;
this.collaborationArn = builder.collaborationArn;
this.collaborationId = builder.collaborationId;
this.collaborationCreatorAccountId = builder.collaborationCreatorAccountId;
this.collaborationCreatorDisplayName = builder.collaborationCreatorDisplayName;
this.collaborationName = builder.collaborationName;
this.createTime = builder.createTime;
this.updateTime = builder.updateTime;
this.status = builder.status;
this.memberAbilities = builder.memberAbilities;
this.queryLogStatus = builder.queryLogStatus;
this.defaultResultConfiguration = builder.defaultResultConfiguration;
this.paymentConfiguration = builder.paymentConfiguration;
}
/**
*
* The unique ID of the membership.
*
*
* @return The unique ID of the membership.
*/
public final String id() {
return id;
}
/**
*
* The unique ARN for the membership.
*
*
* @return The unique ARN for the membership.
*/
public final String arn() {
return arn;
}
/**
*
* The unique ARN for the membership's associated collaboration.
*
*
* @return The unique ARN for the membership's associated collaboration.
*/
public final String collaborationArn() {
return collaborationArn;
}
/**
*
* The unique ID for the membership's collaboration.
*
*
* @return The unique ID for the membership's collaboration.
*/
public final String collaborationId() {
return collaborationId;
}
/**
*
* The identifier used to reference members of the collaboration. Currently only supports Amazon Web Services
* account ID.
*
*
* @return The identifier used to reference members of the collaboration. Currently only supports Amazon Web
* Services account ID.
*/
public final String collaborationCreatorAccountId() {
return collaborationCreatorAccountId;
}
/**
*
* The display name of the collaboration creator.
*
*
* @return The display name of the collaboration creator.
*/
public final String collaborationCreatorDisplayName() {
return collaborationCreatorDisplayName;
}
/**
*
* The name of the membership's collaboration.
*
*
* @return The name of the membership's collaboration.
*/
public final String collaborationName() {
return collaborationName;
}
/**
*
* The time when the membership was created.
*
*
* @return The time when the membership was created.
*/
public final Instant createTime() {
return createTime;
}
/**
*
* The time the membership metadata was last updated.
*
*
* @return The time the membership metadata was last updated.
*/
public final Instant updateTime() {
return updateTime;
}
/**
*
* The status of the membership.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link MembershipStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the membership.
* @see MembershipStatus
*/
public final MembershipStatus status() {
return MembershipStatus.fromValue(status);
}
/**
*
* The status of the membership.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link MembershipStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the membership.
* @see MembershipStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The abilities granted to the collaboration member.
*
*
* 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 #hasMemberAbilities} method.
*
*
* @return The abilities granted to the collaboration member.
*/
public final List memberAbilities() {
return MemberAbilitiesCopier.copyStringToEnum(memberAbilities);
}
/**
* For responses, this returns true if the service returned a value for the MemberAbilities 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 hasMemberAbilities() {
return memberAbilities != null && !(memberAbilities instanceof SdkAutoConstructList);
}
/**
*
* The abilities granted to the collaboration member.
*
*
* 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 #hasMemberAbilities} method.
*
*
* @return The abilities granted to the collaboration member.
*/
public final List memberAbilitiesAsStrings() {
return memberAbilities;
}
/**
*
* An indicator as to whether query logging has been enabled or disabled for the membership.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #queryLogStatus}
* will return {@link MembershipQueryLogStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #queryLogStatusAsString}.
*
*
* @return An indicator as to whether query logging has been enabled or disabled for the membership.
* @see MembershipQueryLogStatus
*/
public final MembershipQueryLogStatus queryLogStatus() {
return MembershipQueryLogStatus.fromValue(queryLogStatus);
}
/**
*
* An indicator as to whether query logging has been enabled or disabled for the membership.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #queryLogStatus}
* will return {@link MembershipQueryLogStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #queryLogStatusAsString}.
*
*
* @return An indicator as to whether query logging has been enabled or disabled for the membership.
* @see MembershipQueryLogStatus
*/
public final String queryLogStatusAsString() {
return queryLogStatus;
}
/**
*
* The default protected query result configuration as specified by the member who can receive results.
*
*
* @return The default protected query result configuration as specified by the member who can receive results.
*/
public final MembershipProtectedQueryResultConfiguration defaultResultConfiguration() {
return defaultResultConfiguration;
}
/**
*
* The payment responsibilities accepted by the collaboration member.
*
*
* @return The payment responsibilities accepted by the collaboration member.
*/
public final MembershipPaymentConfiguration paymentConfiguration() {
return paymentConfiguration;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(collaborationArn());
hashCode = 31 * hashCode + Objects.hashCode(collaborationId());
hashCode = 31 * hashCode + Objects.hashCode(collaborationCreatorAccountId());
hashCode = 31 * hashCode + Objects.hashCode(collaborationCreatorDisplayName());
hashCode = 31 * hashCode + Objects.hashCode(collaborationName());
hashCode = 31 * hashCode + Objects.hashCode(createTime());
hashCode = 31 * hashCode + Objects.hashCode(updateTime());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasMemberAbilities() ? memberAbilitiesAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(queryLogStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(defaultResultConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(paymentConfiguration());
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 Membership)) {
return false;
}
Membership other = (Membership) obj;
return Objects.equals(id(), other.id()) && Objects.equals(arn(), other.arn())
&& Objects.equals(collaborationArn(), other.collaborationArn())
&& Objects.equals(collaborationId(), other.collaborationId())
&& Objects.equals(collaborationCreatorAccountId(), other.collaborationCreatorAccountId())
&& Objects.equals(collaborationCreatorDisplayName(), other.collaborationCreatorDisplayName())
&& Objects.equals(collaborationName(), other.collaborationName())
&& Objects.equals(createTime(), other.createTime()) && Objects.equals(updateTime(), other.updateTime())
&& Objects.equals(statusAsString(), other.statusAsString()) && hasMemberAbilities() == other.hasMemberAbilities()
&& Objects.equals(memberAbilitiesAsStrings(), other.memberAbilitiesAsStrings())
&& Objects.equals(queryLogStatusAsString(), other.queryLogStatusAsString())
&& Objects.equals(defaultResultConfiguration(), other.defaultResultConfiguration())
&& Objects.equals(paymentConfiguration(), other.paymentConfiguration());
}
/**
* 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("Membership").add("Id", id()).add("Arn", arn()).add("CollaborationArn", collaborationArn())
.add("CollaborationId", collaborationId()).add("CollaborationCreatorAccountId", collaborationCreatorAccountId())
.add("CollaborationCreatorDisplayName", collaborationCreatorDisplayName())
.add("CollaborationName", collaborationName()).add("CreateTime", createTime()).add("UpdateTime", updateTime())
.add("Status", statusAsString()).add("MemberAbilities", hasMemberAbilities() ? memberAbilitiesAsStrings() : null)
.add("QueryLogStatus", queryLogStatusAsString()).add("DefaultResultConfiguration", defaultResultConfiguration())
.add("PaymentConfiguration", paymentConfiguration()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "id":
return Optional.ofNullable(clazz.cast(id()));
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "collaborationArn":
return Optional.ofNullable(clazz.cast(collaborationArn()));
case "collaborationId":
return Optional.ofNullable(clazz.cast(collaborationId()));
case "collaborationCreatorAccountId":
return Optional.ofNullable(clazz.cast(collaborationCreatorAccountId()));
case "collaborationCreatorDisplayName":
return Optional.ofNullable(clazz.cast(collaborationCreatorDisplayName()));
case "collaborationName":
return Optional.ofNullable(clazz.cast(collaborationName()));
case "createTime":
return Optional.ofNullable(clazz.cast(createTime()));
case "updateTime":
return Optional.ofNullable(clazz.cast(updateTime()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "memberAbilities":
return Optional.ofNullable(clazz.cast(memberAbilitiesAsStrings()));
case "queryLogStatus":
return Optional.ofNullable(clazz.cast(queryLogStatusAsString()));
case "defaultResultConfiguration":
return Optional.ofNullable(clazz.cast(defaultResultConfiguration()));
case "paymentConfiguration":
return Optional.ofNullable(clazz.cast(paymentConfiguration()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function