
software.amazon.awssdk.services.securityhub.model.Member 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.securityhub.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.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The details about a member account.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Member implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ACCOUNT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AccountId").getter(getter(Member::accountId)).setter(setter(Builder::accountId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AccountId").build()).build();
private static final SdkField EMAIL_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Email")
.getter(getter(Member::email)).setter(setter(Builder::email))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Email").build()).build();
private static final SdkField MASTER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MasterId").getter(getter(Member::masterId)).setter(setter(Builder::masterId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MasterId").build()).build();
private static final SdkField MEMBER_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MemberStatus").getter(getter(Member::memberStatus)).setter(setter(Builder::memberStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MemberStatus").build()).build();
private static final SdkField INVITED_AT_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("InvitedAt")
.getter(getter(Member::invitedAt))
.setter(setter(Builder::invitedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InvitedAt").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField UPDATED_AT_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("UpdatedAt")
.getter(getter(Member::updatedAt))
.setter(setter(Builder::updatedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdatedAt").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACCOUNT_ID_FIELD, EMAIL_FIELD,
MASTER_ID_FIELD, MEMBER_STATUS_FIELD, INVITED_AT_FIELD, UPDATED_AT_FIELD));
private static final long serialVersionUID = 1L;
private final String accountId;
private final String email;
private final String masterId;
private final String memberStatus;
private final Instant invitedAt;
private final Instant updatedAt;
private Member(BuilderImpl builder) {
this.accountId = builder.accountId;
this.email = builder.email;
this.masterId = builder.masterId;
this.memberStatus = builder.memberStatus;
this.invitedAt = builder.invitedAt;
this.updatedAt = builder.updatedAt;
}
/**
*
* The AWS account ID of the member account.
*
*
* @return The AWS account ID of the member account.
*/
public final String accountId() {
return accountId;
}
/**
*
* The email address of the member account.
*
*
* @return The email address of the member account.
*/
public final String email() {
return email;
}
/**
*
* The AWS account ID of the Security Hub master account associated with this member account.
*
*
* @return The AWS account ID of the Security Hub master account associated with this member account.
*/
public final String masterId() {
return masterId;
}
/**
*
* The status of the relationship between the member account and its master account.
*
*
* The status can have one of the following values:
*
*
* -
*
* CREATED
- Indicates that the master account added the member account, but has not yet invited the
* member account.
*
*
* -
*
* INVITED
- Indicates that the master account invited the member account. The member account has not
* yet responded to the invitation.
*
*
* -
*
* ENABLED
- Indicates that the member account is currently active. For manually invited member
* accounts, indicates that the member account accepted the invitation.
*
*
* -
*
* REMOVED
- Indicates that the master account disassociated the member account.
*
*
* -
*
* RESIGNED
- Indicates that the member account disassociated themselves from the master account.
*
*
* -
*
* DELETED
- Indicates that the master account deleted the member account.
*
*
*
*
* @return The status of the relationship between the member account and its master account.
*
* The status can have one of the following values:
*
*
* -
*
* CREATED
- Indicates that the master account added the member account, but has not yet
* invited the member account.
*
*
* -
*
* INVITED
- Indicates that the master account invited the member account. The member account
* has not yet responded to the invitation.
*
*
* -
*
* ENABLED
- Indicates that the member account is currently active. For manually invited member
* accounts, indicates that the member account accepted the invitation.
*
*
* -
*
* REMOVED
- Indicates that the master account disassociated the member account.
*
*
* -
*
* RESIGNED
- Indicates that the member account disassociated themselves from the master
* account.
*
*
* -
*
* DELETED
- Indicates that the master account deleted the member account.
*
*
*/
public final String memberStatus() {
return memberStatus;
}
/**
*
* A timestamp for the date and time when the invitation was sent to the member account.
*
*
* @return A timestamp for the date and time when the invitation was sent to the member account.
*/
public final Instant invitedAt() {
return invitedAt;
}
/**
*
* The timestamp for the date and time when the member account was updated.
*
*
* @return The timestamp for the date and time when the member account was updated.
*/
public final Instant updatedAt() {
return updatedAt;
}
@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(accountId());
hashCode = 31 * hashCode + Objects.hashCode(email());
hashCode = 31 * hashCode + Objects.hashCode(masterId());
hashCode = 31 * hashCode + Objects.hashCode(memberStatus());
hashCode = 31 * hashCode + Objects.hashCode(invitedAt());
hashCode = 31 * hashCode + Objects.hashCode(updatedAt());
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 Member)) {
return false;
}
Member other = (Member) obj;
return Objects.equals(accountId(), other.accountId()) && Objects.equals(email(), other.email())
&& Objects.equals(masterId(), other.masterId()) && Objects.equals(memberStatus(), other.memberStatus())
&& Objects.equals(invitedAt(), other.invitedAt()) && Objects.equals(updatedAt(), other.updatedAt());
}
/**
* 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("Member").add("AccountId", accountId()).add("Email", email()).add("MasterId", masterId())
.add("MemberStatus", memberStatus()).add("InvitedAt", invitedAt()).add("UpdatedAt", updatedAt()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AccountId":
return Optional.ofNullable(clazz.cast(accountId()));
case "Email":
return Optional.ofNullable(clazz.cast(email()));
case "MasterId":
return Optional.ofNullable(clazz.cast(masterId()));
case "MemberStatus":
return Optional.ofNullable(clazz.cast(memberStatus()));
case "InvitedAt":
return Optional.ofNullable(clazz.cast(invitedAt()));
case "UpdatedAt":
return Optional.ofNullable(clazz.cast(updatedAt()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function