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

software.amazon.awssdk.services.ram.model.ResourceShareInvitation 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.ram.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 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;

/**
 * 

* Describes an invitation for an Amazon Web Services account to join a resource share. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ResourceShareInvitation implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField RESOURCE_SHARE_INVITATION_ARN_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("resourceShareInvitationArn") .getter(getter(ResourceShareInvitation::resourceShareInvitationArn)) .setter(setter(Builder::resourceShareInvitationArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceShareInvitationArn").build()) .build(); private static final SdkField RESOURCE_SHARE_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("resourceShareName").getter(getter(ResourceShareInvitation::resourceShareName)) .setter(setter(Builder::resourceShareName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceShareName").build()).build(); private static final SdkField RESOURCE_SHARE_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("resourceShareArn").getter(getter(ResourceShareInvitation::resourceShareArn)) .setter(setter(Builder::resourceShareArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceShareArn").build()).build(); private static final SdkField SENDER_ACCOUNT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("senderAccountId").getter(getter(ResourceShareInvitation::senderAccountId)) .setter(setter(Builder::senderAccountId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("senderAccountId").build()).build(); private static final SdkField RECEIVER_ACCOUNT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("receiverAccountId").getter(getter(ResourceShareInvitation::receiverAccountId)) .setter(setter(Builder::receiverAccountId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("receiverAccountId").build()).build(); private static final SdkField INVITATION_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("invitationTimestamp").getter(getter(ResourceShareInvitation::invitationTimestamp)) .setter(setter(Builder::invitationTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("invitationTimestamp").build()) .build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status") .getter(getter(ResourceShareInvitation::statusAsString)).setter(setter(Builder::status)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build(); private static final SdkField> RESOURCE_SHARE_ASSOCIATIONS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("resourceShareAssociations") .getter(getter(ResourceShareInvitation::resourceShareAssociations)) .setter(setter(Builder::resourceShareAssociations)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceShareAssociations").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ResourceShareAssociation::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField RECEIVER_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("receiverArn").getter(getter(ResourceShareInvitation::receiverArn)).setter(setter(Builder::receiverArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("receiverArn").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList( RESOURCE_SHARE_INVITATION_ARN_FIELD, RESOURCE_SHARE_NAME_FIELD, RESOURCE_SHARE_ARN_FIELD, SENDER_ACCOUNT_ID_FIELD, RECEIVER_ACCOUNT_ID_FIELD, INVITATION_TIMESTAMP_FIELD, STATUS_FIELD, RESOURCE_SHARE_ASSOCIATIONS_FIELD, RECEIVER_ARN_FIELD)); private static final long serialVersionUID = 1L; private final String resourceShareInvitationArn; private final String resourceShareName; private final String resourceShareArn; private final String senderAccountId; private final String receiverAccountId; private final Instant invitationTimestamp; private final String status; private final List resourceShareAssociations; private final String receiverArn; private ResourceShareInvitation(BuilderImpl builder) { this.resourceShareInvitationArn = builder.resourceShareInvitationArn; this.resourceShareName = builder.resourceShareName; this.resourceShareArn = builder.resourceShareArn; this.senderAccountId = builder.senderAccountId; this.receiverAccountId = builder.receiverAccountId; this.invitationTimestamp = builder.invitationTimestamp; this.status = builder.status; this.resourceShareAssociations = builder.resourceShareAssociations; this.receiverArn = builder.receiverArn; } /** *

* The Amazon Resource Name * (ARN) of the invitation. *

* * @return The Amazon Resource * Name (ARN) of the invitation. */ public final String resourceShareInvitationArn() { return resourceShareInvitationArn; } /** *

* The name of the resource share. *

* * @return The name of the resource share. */ public final String resourceShareName() { return resourceShareName; } /** *

* The Amazon Resource Name * (ARN) of the resource share *

* * @return The Amazon Resource * Name (ARN) of the resource share */ public final String resourceShareArn() { return resourceShareArn; } /** *

* The ID of the Amazon Web Services account that sent the invitation. *

* * @return The ID of the Amazon Web Services account that sent the invitation. */ public final String senderAccountId() { return senderAccountId; } /** *

* The ID of the Amazon Web Services account that received the invitation. *

* * @return The ID of the Amazon Web Services account that received the invitation. */ public final String receiverAccountId() { return receiverAccountId; } /** *

* The date and time when the invitation was sent. *

* * @return The date and time when the invitation was sent. */ public final Instant invitationTimestamp() { return invitationTimestamp; } /** *

* The current status of the invitation. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link ResourceShareInvitationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is * available from {@link #statusAsString}. *

* * @return The current status of the invitation. * @see ResourceShareInvitationStatus */ public final ResourceShareInvitationStatus status() { return ResourceShareInvitationStatus.fromValue(status); } /** *

* The current status of the invitation. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link ResourceShareInvitationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is * available from {@link #statusAsString}. *

* * @return The current status of the invitation. * @see ResourceShareInvitationStatus */ public final String statusAsString() { return status; } /** * For responses, this returns true if the service returned a value for the ResourceShareAssociations 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. * * @deprecated This member has been deprecated. Use ListPendingInvitationResources. */ @Deprecated public final boolean hasResourceShareAssociations() { return resourceShareAssociations != null && !(resourceShareAssociations instanceof SdkAutoConstructList); } /** *

* To view the resources associated with a pending resource share invitation, use * ListPendingInvitationResources. *

*

* 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 #hasResourceShareAssociations} method. *

* * @return To view the resources associated with a pending resource share invitation, use * ListPendingInvitationResources. * @deprecated This member has been deprecated. Use ListPendingInvitationResources. */ @Deprecated public final List resourceShareAssociations() { return resourceShareAssociations; } /** *

* The Amazon Resource Name * (ARN) of the IAM user or role that received the invitation. *

* * @return The Amazon Resource * Name (ARN) of the IAM user or role that received the invitation. */ public final String receiverArn() { return receiverArn; } @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(resourceShareInvitationArn()); hashCode = 31 * hashCode + Objects.hashCode(resourceShareName()); hashCode = 31 * hashCode + Objects.hashCode(resourceShareArn()); hashCode = 31 * hashCode + Objects.hashCode(senderAccountId()); hashCode = 31 * hashCode + Objects.hashCode(receiverAccountId()); hashCode = 31 * hashCode + Objects.hashCode(invitationTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasResourceShareAssociations() ? resourceShareAssociations() : null); hashCode = 31 * hashCode + Objects.hashCode(receiverArn()); 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 ResourceShareInvitation)) { return false; } ResourceShareInvitation other = (ResourceShareInvitation) obj; return Objects.equals(resourceShareInvitationArn(), other.resourceShareInvitationArn()) && Objects.equals(resourceShareName(), other.resourceShareName()) && Objects.equals(resourceShareArn(), other.resourceShareArn()) && Objects.equals(senderAccountId(), other.senderAccountId()) && Objects.equals(receiverAccountId(), other.receiverAccountId()) && Objects.equals(invitationTimestamp(), other.invitationTimestamp()) && Objects.equals(statusAsString(), other.statusAsString()) && hasResourceShareAssociations() == other.hasResourceShareAssociations() && Objects.equals(resourceShareAssociations(), other.resourceShareAssociations()) && Objects.equals(receiverArn(), other.receiverArn()); } /** * 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("ResourceShareInvitation").add("ResourceShareInvitationArn", resourceShareInvitationArn()) .add("ResourceShareName", resourceShareName()).add("ResourceShareArn", resourceShareArn()) .add("SenderAccountId", senderAccountId()).add("ReceiverAccountId", receiverAccountId()) .add("InvitationTimestamp", invitationTimestamp()).add("Status", statusAsString()) .add("ResourceShareAssociations", hasResourceShareAssociations() ? resourceShareAssociations() : null) .add("ReceiverArn", receiverArn()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "resourceShareInvitationArn": return Optional.ofNullable(clazz.cast(resourceShareInvitationArn())); case "resourceShareName": return Optional.ofNullable(clazz.cast(resourceShareName())); case "resourceShareArn": return Optional.ofNullable(clazz.cast(resourceShareArn())); case "senderAccountId": return Optional.ofNullable(clazz.cast(senderAccountId())); case "receiverAccountId": return Optional.ofNullable(clazz.cast(receiverAccountId())); case "invitationTimestamp": return Optional.ofNullable(clazz.cast(invitationTimestamp())); case "status": return Optional.ofNullable(clazz.cast(statusAsString())); case "resourceShareAssociations": return Optional.ofNullable(clazz.cast(resourceShareAssociations())); case "receiverArn": return Optional.ofNullable(clazz.cast(receiverArn())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ResourceShareInvitation) 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 invitation. *

* * @param resourceShareInvitationArn * The Amazon * Resource Name (ARN) of the invitation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceShareInvitationArn(String resourceShareInvitationArn); /** *

* The name of the resource share. *

* * @param resourceShareName * The name of the resource share. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceShareName(String resourceShareName); /** *

* The Amazon Resource Name * (ARN) of the resource share *

* * @param resourceShareArn * The Amazon * Resource Name (ARN) of the resource share * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceShareArn(String resourceShareArn); /** *

* The ID of the Amazon Web Services account that sent the invitation. *

* * @param senderAccountId * The ID of the Amazon Web Services account that sent the invitation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder senderAccountId(String senderAccountId); /** *

* The ID of the Amazon Web Services account that received the invitation. *

* * @param receiverAccountId * The ID of the Amazon Web Services account that received the invitation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder receiverAccountId(String receiverAccountId); /** *

* The date and time when the invitation was sent. *

* * @param invitationTimestamp * The date and time when the invitation was sent. * @return Returns a reference to this object so that method calls can be chained together. */ Builder invitationTimestamp(Instant invitationTimestamp); /** *

* The current status of the invitation. *

* * @param status * The current status of the invitation. * @see ResourceShareInvitationStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceShareInvitationStatus */ Builder status(String status); /** *

* The current status of the invitation. *

* * @param status * The current status of the invitation. * @see ResourceShareInvitationStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceShareInvitationStatus */ Builder status(ResourceShareInvitationStatus status); /** *

* To view the resources associated with a pending resource share invitation, use * ListPendingInvitationResources. *

* * @param resourceShareAssociations * To view the resources associated with a pending resource share invitation, use * ListPendingInvitationResources. * @return Returns a reference to this object so that method calls can be chained together. * @deprecated This member has been deprecated. Use ListPendingInvitationResources. */ @Deprecated Builder resourceShareAssociations(Collection resourceShareAssociations); /** *

* To view the resources associated with a pending resource share invitation, use * ListPendingInvitationResources. *

* * @param resourceShareAssociations * To view the resources associated with a pending resource share invitation, use * ListPendingInvitationResources. * @return Returns a reference to this object so that method calls can be chained together. * @deprecated This member has been deprecated. Use ListPendingInvitationResources. */ @Deprecated Builder resourceShareAssociations(ResourceShareAssociation... resourceShareAssociations); /** *

* To view the resources associated with a pending resource share invitation, use * ListPendingInvitationResources. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.ram.model.ResourceShareAssociation.Builder} avoiding the need to * create one manually via {@link software.amazon.awssdk.services.ram.model.ResourceShareAssociation#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.ram.model.ResourceShareAssociation.Builder#build()} is called * immediately and its result is passed to {@link #resourceShareAssociations(List)}. * * @param resourceShareAssociations * a consumer that will call methods on * {@link software.amazon.awssdk.services.ram.model.ResourceShareAssociation.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #resourceShareAssociations(java.util.Collection) * @deprecated This member has been deprecated. Use ListPendingInvitationResources. */ @Deprecated Builder resourceShareAssociations(Consumer... resourceShareAssociations); /** *

* The Amazon Resource Name * (ARN) of the IAM user or role that received the invitation. *

* * @param receiverArn * The Amazon * Resource Name (ARN) of the IAM user or role that received the invitation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder receiverArn(String receiverArn); } static final class BuilderImpl implements Builder { private String resourceShareInvitationArn; private String resourceShareName; private String resourceShareArn; private String senderAccountId; private String receiverAccountId; private Instant invitationTimestamp; private String status; private List resourceShareAssociations = DefaultSdkAutoConstructList.getInstance(); private String receiverArn; private BuilderImpl() { } private BuilderImpl(ResourceShareInvitation model) { resourceShareInvitationArn(model.resourceShareInvitationArn); resourceShareName(model.resourceShareName); resourceShareArn(model.resourceShareArn); senderAccountId(model.senderAccountId); receiverAccountId(model.receiverAccountId); invitationTimestamp(model.invitationTimestamp); status(model.status); resourceShareAssociations(model.resourceShareAssociations); receiverArn(model.receiverArn); } public final String getResourceShareInvitationArn() { return resourceShareInvitationArn; } public final void setResourceShareInvitationArn(String resourceShareInvitationArn) { this.resourceShareInvitationArn = resourceShareInvitationArn; } @Override public final Builder resourceShareInvitationArn(String resourceShareInvitationArn) { this.resourceShareInvitationArn = resourceShareInvitationArn; return this; } public final String getResourceShareName() { return resourceShareName; } public final void setResourceShareName(String resourceShareName) { this.resourceShareName = resourceShareName; } @Override public final Builder resourceShareName(String resourceShareName) { this.resourceShareName = resourceShareName; return this; } public final String getResourceShareArn() { return resourceShareArn; } public final void setResourceShareArn(String resourceShareArn) { this.resourceShareArn = resourceShareArn; } @Override public final Builder resourceShareArn(String resourceShareArn) { this.resourceShareArn = resourceShareArn; return this; } public final String getSenderAccountId() { return senderAccountId; } public final void setSenderAccountId(String senderAccountId) { this.senderAccountId = senderAccountId; } @Override public final Builder senderAccountId(String senderAccountId) { this.senderAccountId = senderAccountId; return this; } public final String getReceiverAccountId() { return receiverAccountId; } public final void setReceiverAccountId(String receiverAccountId) { this.receiverAccountId = receiverAccountId; } @Override public final Builder receiverAccountId(String receiverAccountId) { this.receiverAccountId = receiverAccountId; return this; } public final Instant getInvitationTimestamp() { return invitationTimestamp; } public final void setInvitationTimestamp(Instant invitationTimestamp) { this.invitationTimestamp = invitationTimestamp; } @Override public final Builder invitationTimestamp(Instant invitationTimestamp) { this.invitationTimestamp = invitationTimestamp; return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(ResourceShareInvitationStatus status) { this.status(status == null ? null : status.toString()); return this; } @Deprecated public final List getResourceShareAssociations() { List result = ResourceShareAssociationListCopier .copyToBuilder(this.resourceShareAssociations); if (result instanceof SdkAutoConstructList) { return null; } return result; } @Deprecated public final void setResourceShareAssociations(Collection resourceShareAssociations) { this.resourceShareAssociations = ResourceShareAssociationListCopier.copyFromBuilder(resourceShareAssociations); } @Override @Deprecated public final Builder resourceShareAssociations(Collection resourceShareAssociations) { this.resourceShareAssociations = ResourceShareAssociationListCopier.copy(resourceShareAssociations); return this; } @Override @SafeVarargs @Deprecated public final Builder resourceShareAssociations(ResourceShareAssociation... resourceShareAssociations) { resourceShareAssociations(Arrays.asList(resourceShareAssociations)); return this; } @Override @SafeVarargs @Deprecated public final Builder resourceShareAssociations(Consumer... resourceShareAssociations) { resourceShareAssociations(Stream.of(resourceShareAssociations) .map(c -> ResourceShareAssociation.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final String getReceiverArn() { return receiverArn; } public final void setReceiverArn(String receiverArn) { this.receiverArn = receiverArn; } @Override public final Builder receiverArn(String receiverArn) { this.receiverArn = receiverArn; return this; } @Override public ResourceShareInvitation build() { return new ResourceShareInvitation(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy