All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.cleanrooms.model.MemberSpecification 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.cleanrooms.model;

import java.io.Serializable;
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;

/**
 * 

* Basic metadata used to construct a new member. *

*/ @Generated("software.amazon.awssdk:codegen") public final class MemberSpecification implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ACCOUNT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("accountId").getter(getter(MemberSpecification::accountId)).setter(setter(Builder::accountId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("accountId").build()).build(); private static final SdkField> MEMBER_ABILITIES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("memberAbilities") .getter(getter(MemberSpecification::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 DISPLAY_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("displayName").getter(getter(MemberSpecification::displayName)).setter(setter(Builder::displayName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("displayName").build()).build(); private static final SdkField PAYMENT_CONFIGURATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("paymentConfiguration") .getter(getter(MemberSpecification::paymentConfiguration)).setter(setter(Builder::paymentConfiguration)) .constructor(PaymentConfiguration::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("paymentConfiguration").build()) .build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACCOUNT_ID_FIELD, MEMBER_ABILITIES_FIELD, DISPLAY_NAME_FIELD, PAYMENT_CONFIGURATION_FIELD)); private static final long serialVersionUID = 1L; private final String accountId; private final List memberAbilities; private final String displayName; private final PaymentConfiguration paymentConfiguration; private MemberSpecification(BuilderImpl builder) { this.accountId = builder.accountId; this.memberAbilities = builder.memberAbilities; this.displayName = builder.displayName; this.paymentConfiguration = builder.paymentConfiguration; } /** *

* 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 accountId() { return accountId; } /** *

* 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; } /** *

* The member's display name. *

* * @return The member's display name. */ public final String displayName() { return displayName; } /** *

* The collaboration member's payment responsibilities set by the collaboration creator. *

*

* If the collaboration creator hasn't specified anyone as the member paying for query compute costs, then the member * who can query is the default payer. *

* * @return The collaboration member's payment responsibilities set by the collaboration creator.

*

* If the collaboration creator hasn't specified anyone as the member paying for query compute costs, then * the member who can query is the default payer. */ public final PaymentConfiguration paymentConfiguration() { return paymentConfiguration; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(accountId()); hashCode = 31 * hashCode + Objects.hashCode(hasMemberAbilities() ? memberAbilitiesAsStrings() : null); hashCode = 31 * hashCode + Objects.hashCode(displayName()); 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 MemberSpecification)) { return false; } MemberSpecification other = (MemberSpecification) obj; return Objects.equals(accountId(), other.accountId()) && hasMemberAbilities() == other.hasMemberAbilities() && Objects.equals(memberAbilitiesAsStrings(), other.memberAbilitiesAsStrings()) && Objects.equals(displayName(), other.displayName()) && 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("MemberSpecification").add("AccountId", accountId()) .add("MemberAbilities", hasMemberAbilities() ? memberAbilitiesAsStrings() : null) .add("DisplayName", displayName()).add("PaymentConfiguration", paymentConfiguration()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "accountId": return Optional.ofNullable(clazz.cast(accountId())); case "memberAbilities": return Optional.ofNullable(clazz.cast(memberAbilitiesAsStrings())); case "displayName": return Optional.ofNullable(clazz.cast(displayName())); case "paymentConfiguration": return Optional.ofNullable(clazz.cast(paymentConfiguration())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((MemberSpecification) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The identifier used to reference members of the collaboration. Currently only supports Amazon Web Services * account ID. *

* * @param accountId * The identifier used to reference members of the collaboration. Currently only supports Amazon Web * Services account ID. * @return Returns a reference to this object so that method calls can be chained together. */ Builder accountId(String accountId); /** *

* The abilities granted to the collaboration member. *

* * @param memberAbilities * The abilities granted to the collaboration member. * @return Returns a reference to this object so that method calls can be chained together. */ Builder memberAbilitiesWithStrings(Collection memberAbilities); /** *

* The abilities granted to the collaboration member. *

* * @param memberAbilities * The abilities granted to the collaboration member. * @return Returns a reference to this object so that method calls can be chained together. */ Builder memberAbilitiesWithStrings(String... memberAbilities); /** *

* The abilities granted to the collaboration member. *

* * @param memberAbilities * The abilities granted to the collaboration member. * @return Returns a reference to this object so that method calls can be chained together. */ Builder memberAbilities(Collection memberAbilities); /** *

* The abilities granted to the collaboration member. *

* * @param memberAbilities * The abilities granted to the collaboration member. * @return Returns a reference to this object so that method calls can be chained together. */ Builder memberAbilities(MemberAbility... memberAbilities); /** *

* The member's display name. *

* * @param displayName * The member's display name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder displayName(String displayName); /** *

* The collaboration member's payment responsibilities set by the collaboration creator. *

*

* If the collaboration creator hasn't specified anyone as the member paying for query compute costs, then the * member who can query is the default payer. *

* * @param paymentConfiguration * The collaboration member's payment responsibilities set by the collaboration creator.

*

* If the collaboration creator hasn't specified anyone as the member paying for query compute costs, then * the member who can query is the default payer. * @return Returns a reference to this object so that method calls can be chained together. */ Builder paymentConfiguration(PaymentConfiguration paymentConfiguration); /** *

* The collaboration member's payment responsibilities set by the collaboration creator. *

*

* If the collaboration creator hasn't specified anyone as the member paying for query compute costs, then the * member who can query is the default payer. *

* This is a convenience method that creates an instance of the {@link PaymentConfiguration.Builder} avoiding * the need to create one manually via {@link PaymentConfiguration#builder()}. * *

* When the {@link Consumer} completes, {@link PaymentConfiguration.Builder#build()} is called immediately and * its result is passed to {@link #paymentConfiguration(PaymentConfiguration)}. * * @param paymentConfiguration * a consumer that will call methods on {@link PaymentConfiguration.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #paymentConfiguration(PaymentConfiguration) */ default Builder paymentConfiguration(Consumer paymentConfiguration) { return paymentConfiguration(PaymentConfiguration.builder().applyMutation(paymentConfiguration).build()); } } static final class BuilderImpl implements Builder { private String accountId; private List memberAbilities = DefaultSdkAutoConstructList.getInstance(); private String displayName; private PaymentConfiguration paymentConfiguration; private BuilderImpl() { } private BuilderImpl(MemberSpecification model) { accountId(model.accountId); memberAbilitiesWithStrings(model.memberAbilities); displayName(model.displayName); paymentConfiguration(model.paymentConfiguration); } public final String getAccountId() { return accountId; } public final void setAccountId(String accountId) { this.accountId = accountId; } @Override public final Builder accountId(String accountId) { this.accountId = accountId; return this; } public final Collection getMemberAbilities() { if (memberAbilities instanceof SdkAutoConstructList) { return null; } return memberAbilities; } public final void setMemberAbilities(Collection memberAbilities) { this.memberAbilities = MemberAbilitiesCopier.copy(memberAbilities); } @Override public final Builder memberAbilitiesWithStrings(Collection memberAbilities) { this.memberAbilities = MemberAbilitiesCopier.copy(memberAbilities); return this; } @Override @SafeVarargs public final Builder memberAbilitiesWithStrings(String... memberAbilities) { memberAbilitiesWithStrings(Arrays.asList(memberAbilities)); return this; } @Override public final Builder memberAbilities(Collection memberAbilities) { this.memberAbilities = MemberAbilitiesCopier.copyEnumToString(memberAbilities); return this; } @Override @SafeVarargs public final Builder memberAbilities(MemberAbility... memberAbilities) { memberAbilities(Arrays.asList(memberAbilities)); return this; } public final String getDisplayName() { return displayName; } public final void setDisplayName(String displayName) { this.displayName = displayName; } @Override public final Builder displayName(String displayName) { this.displayName = displayName; return this; } public final PaymentConfiguration.Builder getPaymentConfiguration() { return paymentConfiguration != null ? paymentConfiguration.toBuilder() : null; } public final void setPaymentConfiguration(PaymentConfiguration.BuilderImpl paymentConfiguration) { this.paymentConfiguration = paymentConfiguration != null ? paymentConfiguration.build() : null; } @Override public final Builder paymentConfiguration(PaymentConfiguration paymentConfiguration) { this.paymentConfiguration = paymentConfiguration; return this; } @Override public MemberSpecification build() { return new MemberSpecification(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy