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

software.amazon.awssdk.services.ram.model.Principal 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.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Describes a principal for use with Resource Access Manager. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Principal implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("id") .getter(getter(Principal::id)).setter(setter(Builder::id)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("id").build()).build(); private static final SdkField RESOURCE_SHARE_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("resourceShareArn").getter(getter(Principal::resourceShareArn)).setter(setter(Builder::resourceShareArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceShareArn").build()).build(); private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("creationTime").getter(getter(Principal::creationTime)).setter(setter(Builder::creationTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationTime").build()).build(); private static final SdkField LAST_UPDATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("lastUpdatedTime").getter(getter(Principal::lastUpdatedTime)).setter(setter(Builder::lastUpdatedTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastUpdatedTime").build()).build(); private static final SdkField EXTERNAL_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("external").getter(getter(Principal::external)).setter(setter(Builder::external)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("external").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, RESOURCE_SHARE_ARN_FIELD, CREATION_TIME_FIELD, LAST_UPDATED_TIME_FIELD, EXTERNAL_FIELD)); private static final long serialVersionUID = 1L; private final String id; private final String resourceShareArn; private final Instant creationTime; private final Instant lastUpdatedTime; private final Boolean external; private Principal(BuilderImpl builder) { this.id = builder.id; this.resourceShareArn = builder.resourceShareArn; this.creationTime = builder.creationTime; this.lastUpdatedTime = builder.lastUpdatedTime; this.external = builder.external; } /** *

* The ID of the principal that can be associated with a resource share. *

* * @return The ID of the principal that can be associated with a resource share. */ public final String id() { return id; } /** *

* The Amazon Resource Name * (ARN) of a resource share the principal is associated with. *

* * @return The Amazon Resource * Name (ARN) of a resource share the principal is associated with. */ public final String resourceShareArn() { return resourceShareArn; } /** *

* The date and time when the principal was associated with the resource share. *

* * @return The date and time when the principal was associated with the resource share. */ public final Instant creationTime() { return creationTime; } /** *

* The date and time when the association between the resource share and the principal was last updated. *

* * @return The date and time when the association between the resource share and the principal was last updated. */ public final Instant lastUpdatedTime() { return lastUpdatedTime; } /** *

* Indicates the relationship between the Amazon Web Services account the principal belongs to and the account that * owns the resource share: *

*
    *
  • *

    * True – The two accounts belong to same organization. *

    *
  • *
  • *

    * False – The two accounts do not belong to the same organization. *

    *
  • *
* * @return Indicates the relationship between the Amazon Web Services account the principal belongs to and the * account that owns the resource share:

*
    *
  • *

    * True – The two accounts belong to same organization. *

    *
  • *
  • *

    * False – The two accounts do not belong to the same organization. *

    *
  • */ public final Boolean external() { return external; } @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(id()); hashCode = 31 * hashCode + Objects.hashCode(resourceShareArn()); hashCode = 31 * hashCode + Objects.hashCode(creationTime()); hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTime()); hashCode = 31 * hashCode + Objects.hashCode(external()); 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 Principal)) { return false; } Principal other = (Principal) obj; return Objects.equals(id(), other.id()) && Objects.equals(resourceShareArn(), other.resourceShareArn()) && Objects.equals(creationTime(), other.creationTime()) && Objects.equals(lastUpdatedTime(), other.lastUpdatedTime()) && Objects.equals(external(), other.external()); } /** * 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("Principal").add("Id", id()).add("ResourceShareArn", resourceShareArn()) .add("CreationTime", creationTime()).add("LastUpdatedTime", lastUpdatedTime()).add("External", external()) .build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "id": return Optional.ofNullable(clazz.cast(id())); case "resourceShareArn": return Optional.ofNullable(clazz.cast(resourceShareArn())); case "creationTime": return Optional.ofNullable(clazz.cast(creationTime())); case "lastUpdatedTime": return Optional.ofNullable(clazz.cast(lastUpdatedTime())); case "external": return Optional.ofNullable(clazz.cast(external())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Principal) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

    * The ID of the principal that can be associated with a resource share. *

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

    * The Amazon Resource Name * (ARN) of a resource share the principal is associated with. *

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

    * The date and time when the principal was associated with the resource share. *

    * * @param creationTime * The date and time when the principal was associated with the resource share. * @return Returns a reference to this object so that method calls can be chained together. */ Builder creationTime(Instant creationTime); /** *

    * The date and time when the association between the resource share and the principal was last updated. *

    * * @param lastUpdatedTime * The date and time when the association between the resource share and the principal was last updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastUpdatedTime(Instant lastUpdatedTime); /** *

    * Indicates the relationship between the Amazon Web Services account the principal belongs to and the account * that owns the resource share: *

    *
      *
    • *

      * True – The two accounts belong to same organization. *

      *
    • *
    • *

      * False – The two accounts do not belong to the same organization. *

      *
    • *
    * * @param external * Indicates the relationship between the Amazon Web Services account the principal belongs to and the * account that owns the resource share:

    *
      *
    • *

      * True – The two accounts belong to same organization. *

      *
    • *
    • *

      * False – The two accounts do not belong to the same organization. *

      *
    • * @return Returns a reference to this object so that method calls can be chained together. */ Builder external(Boolean external); } static final class BuilderImpl implements Builder { private String id; private String resourceShareArn; private Instant creationTime; private Instant lastUpdatedTime; private Boolean external; private BuilderImpl() { } private BuilderImpl(Principal model) { id(model.id); resourceShareArn(model.resourceShareArn); creationTime(model.creationTime); lastUpdatedTime(model.lastUpdatedTime); external(model.external); } public final String getId() { return id; } public final void setId(String id) { this.id = id; } @Override public final Builder id(String id) { this.id = id; 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 Instant getCreationTime() { return creationTime; } public final void setCreationTime(Instant creationTime) { this.creationTime = creationTime; } @Override public final Builder creationTime(Instant creationTime) { this.creationTime = creationTime; return this; } public final Instant getLastUpdatedTime() { return lastUpdatedTime; } public final void setLastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; } @Override public final Builder lastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; return this; } public final Boolean getExternal() { return external; } public final void setExternal(Boolean external) { this.external = external; } @Override public final Builder external(Boolean external) { this.external = external; return this; } @Override public Principal build() { return new Principal(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy