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

software.amazon.awssdk.services.managedblockchain.model.Invitation 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.managedblockchain.model;

import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
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.LocationTrait;
import software.amazon.awssdk.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* An invitation to an Amazon Web Services account to create a member and join the network. *

*

* Applies only to Hyperledger Fabric. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Invitation implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField INVITATION_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("InvitationId").getter(getter(Invitation::invitationId)).setter(setter(Builder::invitationId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InvitationId").build()).build(); private static final SdkField CREATION_DATE_FIELD = SdkField . builder(MarshallingType.INSTANT) .memberName("CreationDate") .getter(getter(Invitation::creationDate)) .setter(setter(Builder::creationDate)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationDate").build(), TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build(); private static final SdkField EXPIRATION_DATE_FIELD = SdkField . builder(MarshallingType.INSTANT) .memberName("ExpirationDate") .getter(getter(Invitation::expirationDate)) .setter(setter(Builder::expirationDate)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExpirationDate").build(), TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status") .getter(getter(Invitation::statusAsString)).setter(setter(Builder::status)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build(); private static final SdkField NETWORK_SUMMARY_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("NetworkSummary") .getter(getter(Invitation::networkSummary)).setter(setter(Builder::networkSummary)) .constructor(NetworkSummary::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NetworkSummary").build()).build(); private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn") .getter(getter(Invitation::arn)).setter(setter(Builder::arn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INVITATION_ID_FIELD, CREATION_DATE_FIELD, EXPIRATION_DATE_FIELD, STATUS_FIELD, NETWORK_SUMMARY_FIELD, ARN_FIELD)); private static final long serialVersionUID = 1L; private final String invitationId; private final Instant creationDate; private final Instant expirationDate; private final String status; private final NetworkSummary networkSummary; private final String arn; private Invitation(BuilderImpl builder) { this.invitationId = builder.invitationId; this.creationDate = builder.creationDate; this.expirationDate = builder.expirationDate; this.status = builder.status; this.networkSummary = builder.networkSummary; this.arn = builder.arn; } /** *

* The unique identifier for the invitation. *

* * @return The unique identifier for the invitation. */ public final String invitationId() { return invitationId; } /** *

* The date and time that the invitation was created. *

* * @return The date and time that the invitation was created. */ public final Instant creationDate() { return creationDate; } /** *

* The date and time that the invitation expires. This is the CreationDate plus the * ProposalDurationInHours that is specified in the ProposalThresholdPolicy. After this * date and time, the invitee can no longer create a member and join the network using this * InvitationId. *

* * @return The date and time that the invitation expires. This is the CreationDate plus the * ProposalDurationInHours that is specified in the ProposalThresholdPolicy. After * this date and time, the invitee can no longer create a member and join the network using this * InvitationId. */ public final Instant expirationDate() { return expirationDate; } /** *

* The status of the invitation: *

*
    *
  • *

    * PENDING - The invitee hasn't created a member to join the network, and the invitation hasn't yet * expired. *

    *
  • *
  • *

    * ACCEPTING - The invitee has begun creating a member, and creation hasn't yet completed. *

    *
  • *
  • *

    * ACCEPTED - The invitee created a member and joined the network using the InvitationID. *

    *
  • *
  • *

    * REJECTED - The invitee rejected the invitation. *

    *
  • *
  • *

    * EXPIRED - The invitee neither created a member nor rejected the invitation before the * ExpirationDate. *

    *
  • *
*

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

* * @return The status of the invitation:

*
    *
  • *

    * PENDING - The invitee hasn't created a member to join the network, and the invitation hasn't * yet expired. *

    *
  • *
  • *

    * ACCEPTING - The invitee has begun creating a member, and creation hasn't yet completed. *

    *
  • *
  • *

    * ACCEPTED - The invitee created a member and joined the network using the * InvitationID. *

    *
  • *
  • *

    * REJECTED - The invitee rejected the invitation. *

    *
  • *
  • *

    * EXPIRED - The invitee neither created a member nor rejected the invitation before the * ExpirationDate. *

    *
  • * @see InvitationStatus */ public final InvitationStatus status() { return InvitationStatus.fromValue(status); } /** *

    * The status of the invitation: *

    *
      *
    • *

      * PENDING - The invitee hasn't created a member to join the network, and the invitation hasn't yet * expired. *

      *
    • *
    • *

      * ACCEPTING - The invitee has begun creating a member, and creation hasn't yet completed. *

      *
    • *
    • *

      * ACCEPTED - The invitee created a member and joined the network using the InvitationID. *

      *
    • *
    • *

      * REJECTED - The invitee rejected the invitation. *

      *
    • *
    • *

      * EXPIRED - The invitee neither created a member nor rejected the invitation before the * ExpirationDate. *

      *
    • *
    *

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

    * * @return The status of the invitation:

    *
      *
    • *

      * PENDING - The invitee hasn't created a member to join the network, and the invitation hasn't * yet expired. *

      *
    • *
    • *

      * ACCEPTING - The invitee has begun creating a member, and creation hasn't yet completed. *

      *
    • *
    • *

      * ACCEPTED - The invitee created a member and joined the network using the * InvitationID. *

      *
    • *
    • *

      * REJECTED - The invitee rejected the invitation. *

      *
    • *
    • *

      * EXPIRED - The invitee neither created a member nor rejected the invitation before the * ExpirationDate. *

      *
    • * @see InvitationStatus */ public final String statusAsString() { return status; } /** * Returns the value of the NetworkSummary property for this object. * * @return The value of the NetworkSummary property for this object. */ public final NetworkSummary networkSummary() { return networkSummary; } /** *

      * The Amazon Resource Name (ARN) of the invitation. For more information about ARNs and their format, see Amazon Resource Names * (ARNs) in the Amazon Web Services General Reference. *

      * * @return The Amazon Resource Name (ARN) of the invitation. For more information about ARNs and their format, see * Amazon Resource * Names (ARNs) in the Amazon Web Services General Reference. */ public final String arn() { return arn; } @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(invitationId()); hashCode = 31 * hashCode + Objects.hashCode(creationDate()); hashCode = 31 * hashCode + Objects.hashCode(expirationDate()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(networkSummary()); hashCode = 31 * hashCode + Objects.hashCode(arn()); 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 Invitation)) { return false; } Invitation other = (Invitation) obj; return Objects.equals(invitationId(), other.invitationId()) && Objects.equals(creationDate(), other.creationDate()) && Objects.equals(expirationDate(), other.expirationDate()) && Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(networkSummary(), other.networkSummary()) && Objects.equals(arn(), other.arn()); } /** * 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("Invitation").add("InvitationId", invitationId()).add("CreationDate", creationDate()) .add("ExpirationDate", expirationDate()).add("Status", statusAsString()).add("NetworkSummary", networkSummary()) .add("Arn", arn()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "InvitationId": return Optional.ofNullable(clazz.cast(invitationId())); case "CreationDate": return Optional.ofNullable(clazz.cast(creationDate())); case "ExpirationDate": return Optional.ofNullable(clazz.cast(expirationDate())); case "Status": return Optional.ofNullable(clazz.cast(statusAsString())); case "NetworkSummary": return Optional.ofNullable(clazz.cast(networkSummary())); case "Arn": return Optional.ofNullable(clazz.cast(arn())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Invitation) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

      * The unique identifier for the invitation. *

      * * @param invitationId * The unique identifier for the invitation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder invitationId(String invitationId); /** *

      * The date and time that the invitation was created. *

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

      * The date and time that the invitation expires. This is the CreationDate plus the * ProposalDurationInHours that is specified in the ProposalThresholdPolicy. After * this date and time, the invitee can no longer create a member and join the network using this * InvitationId. *

      * * @param expirationDate * The date and time that the invitation expires. This is the CreationDate plus the * ProposalDurationInHours that is specified in the ProposalThresholdPolicy. * After this date and time, the invitee can no longer create a member and join the network using this * InvitationId. * @return Returns a reference to this object so that method calls can be chained together. */ Builder expirationDate(Instant expirationDate); /** *

      * The status of the invitation: *

      *
        *
      • *

        * PENDING - The invitee hasn't created a member to join the network, and the invitation hasn't yet * expired. *

        *
      • *
      • *

        * ACCEPTING - The invitee has begun creating a member, and creation hasn't yet completed. *

        *
      • *
      • *

        * ACCEPTED - The invitee created a member and joined the network using the * InvitationID. *

        *
      • *
      • *

        * REJECTED - The invitee rejected the invitation. *

        *
      • *
      • *

        * EXPIRED - The invitee neither created a member nor rejected the invitation before the * ExpirationDate. *

        *
      • *
      * * @param status * The status of the invitation:

      *
        *
      • *

        * PENDING - The invitee hasn't created a member to join the network, and the invitation * hasn't yet expired. *

        *
      • *
      • *

        * ACCEPTING - The invitee has begun creating a member, and creation hasn't yet completed. *

        *
      • *
      • *

        * ACCEPTED - The invitee created a member and joined the network using the * InvitationID. *

        *
      • *
      • *

        * REJECTED - The invitee rejected the invitation. *

        *
      • *
      • *

        * EXPIRED - The invitee neither created a member nor rejected the invitation before the * ExpirationDate. *

        *
      • * @see InvitationStatus * @return Returns a reference to this object so that method calls can be chained together. * @see InvitationStatus */ Builder status(String status); /** *

        * The status of the invitation: *

        *
          *
        • *

          * PENDING - The invitee hasn't created a member to join the network, and the invitation hasn't yet * expired. *

          *
        • *
        • *

          * ACCEPTING - The invitee has begun creating a member, and creation hasn't yet completed. *

          *
        • *
        • *

          * ACCEPTED - The invitee created a member and joined the network using the * InvitationID. *

          *
        • *
        • *

          * REJECTED - The invitee rejected the invitation. *

          *
        • *
        • *

          * EXPIRED - The invitee neither created a member nor rejected the invitation before the * ExpirationDate. *

          *
        • *
        * * @param status * The status of the invitation:

        *
          *
        • *

          * PENDING - The invitee hasn't created a member to join the network, and the invitation * hasn't yet expired. *

          *
        • *
        • *

          * ACCEPTING - The invitee has begun creating a member, and creation hasn't yet completed. *

          *
        • *
        • *

          * ACCEPTED - The invitee created a member and joined the network using the * InvitationID. *

          *
        • *
        • *

          * REJECTED - The invitee rejected the invitation. *

          *
        • *
        • *

          * EXPIRED - The invitee neither created a member nor rejected the invitation before the * ExpirationDate. *

          *
        • * @see InvitationStatus * @return Returns a reference to this object so that method calls can be chained together. * @see InvitationStatus */ Builder status(InvitationStatus status); /** * Sets the value of the NetworkSummary property for this object. * * @param networkSummary * The new value for the NetworkSummary property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder networkSummary(NetworkSummary networkSummary); /** * Sets the value of the NetworkSummary property for this object. * * This is a convenience method that creates an instance of the {@link NetworkSummary.Builder} avoiding the need * to create one manually via {@link NetworkSummary#builder()}. * *

          * When the {@link Consumer} completes, {@link NetworkSummary.Builder#build()} is called immediately and its * result is passed to {@link #networkSummary(NetworkSummary)}. * * @param networkSummary * a consumer that will call methods on {@link NetworkSummary.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #networkSummary(NetworkSummary) */ default Builder networkSummary(Consumer networkSummary) { return networkSummary(NetworkSummary.builder().applyMutation(networkSummary).build()); } /** *

          * The Amazon Resource Name (ARN) of the invitation. For more information about ARNs and their format, see Amazon Resource Names * (ARNs) in the Amazon Web Services General Reference. *

          * * @param arn * The Amazon Resource Name (ARN) of the invitation. For more information about ARNs and their format, * see Amazon * Resource Names (ARNs) in the Amazon Web Services General Reference. * @return Returns a reference to this object so that method calls can be chained together. */ Builder arn(String arn); } static final class BuilderImpl implements Builder { private String invitationId; private Instant creationDate; private Instant expirationDate; private String status; private NetworkSummary networkSummary; private String arn; private BuilderImpl() { } private BuilderImpl(Invitation model) { invitationId(model.invitationId); creationDate(model.creationDate); expirationDate(model.expirationDate); status(model.status); networkSummary(model.networkSummary); arn(model.arn); } public final String getInvitationId() { return invitationId; } public final void setInvitationId(String invitationId) { this.invitationId = invitationId; } @Override public final Builder invitationId(String invitationId) { this.invitationId = invitationId; return this; } public final Instant getCreationDate() { return creationDate; } public final void setCreationDate(Instant creationDate) { this.creationDate = creationDate; } @Override public final Builder creationDate(Instant creationDate) { this.creationDate = creationDate; return this; } public final Instant getExpirationDate() { return expirationDate; } public final void setExpirationDate(Instant expirationDate) { this.expirationDate = expirationDate; } @Override public final Builder expirationDate(Instant expirationDate) { this.expirationDate = expirationDate; 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(InvitationStatus status) { this.status(status == null ? null : status.toString()); return this; } public final NetworkSummary.Builder getNetworkSummary() { return networkSummary != null ? networkSummary.toBuilder() : null; } public final void setNetworkSummary(NetworkSummary.BuilderImpl networkSummary) { this.networkSummary = networkSummary != null ? networkSummary.build() : null; } @Override public final Builder networkSummary(NetworkSummary networkSummary) { this.networkSummary = networkSummary; return this; } public final String getArn() { return arn; } public final void setArn(String arn) { this.arn = arn; } @Override public final Builder arn(String arn) { this.arn = arn; return this; } @Override public Invitation build() { return new Invitation(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy