software.amazon.awssdk.services.codestar.model.DescribeUserProfileResponse 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.codestar.model;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeUserProfileResponse extends CodeStarResponse implements
ToCopyableBuilder {
private static final SdkField USER_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("userArn").getter(getter(DescribeUserProfileResponse::userArn)).setter(setter(Builder::userArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("userArn").build()).build();
private static final SdkField DISPLAY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("displayName").getter(getter(DescribeUserProfileResponse::displayName))
.setter(setter(Builder::displayName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("displayName").build()).build();
private static final SdkField EMAIL_ADDRESS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("emailAddress").getter(getter(DescribeUserProfileResponse::emailAddress))
.setter(setter(Builder::emailAddress))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("emailAddress").build()).build();
private static final SdkField SSH_PUBLIC_KEY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("sshPublicKey").getter(getter(DescribeUserProfileResponse::sshPublicKey))
.setter(setter(Builder::sshPublicKey))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sshPublicKey").build()).build();
private static final SdkField CREATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("createdTimestamp").getter(getter(DescribeUserProfileResponse::createdTimestamp))
.setter(setter(Builder::createdTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdTimestamp").build()).build();
private static final SdkField LAST_MODIFIED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastModifiedTimestamp").getter(getter(DescribeUserProfileResponse::lastModifiedTimestamp))
.setter(setter(Builder::lastModifiedTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastModifiedTimestamp").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays
.asList(USER_ARN_FIELD, DISPLAY_NAME_FIELD, EMAIL_ADDRESS_FIELD, SSH_PUBLIC_KEY_FIELD, CREATED_TIMESTAMP_FIELD,
LAST_MODIFIED_TIMESTAMP_FIELD));
private final String userArn;
private final String displayName;
private final String emailAddress;
private final String sshPublicKey;
private final Instant createdTimestamp;
private final Instant lastModifiedTimestamp;
private DescribeUserProfileResponse(BuilderImpl builder) {
super(builder);
this.userArn = builder.userArn;
this.displayName = builder.displayName;
this.emailAddress = builder.emailAddress;
this.sshPublicKey = builder.sshPublicKey;
this.createdTimestamp = builder.createdTimestamp;
this.lastModifiedTimestamp = builder.lastModifiedTimestamp;
}
/**
*
* The Amazon Resource Name (ARN) of the user.
*
*
* @return The Amazon Resource Name (ARN) of the user.
*/
public final String userArn() {
return userArn;
}
/**
*
* The display name shown for the user in AWS CodeStar projects. For example, this could be set to both first and
* last name ("Mary Major") or a single name ("Mary"). The display name is also used to generate the initial icon
* associated with the user in AWS CodeStar projects. If spaces are included in the display name, the first
* character that appears after the space will be used as the second character in the user initial icon. The initial
* icon displays a maximum of two characters, so a display name with more than one space (for example
* "Mary Jane Major") would generate an initial icon using the first character and the first character after the
* space ("MJ", not "MM").
*
*
* @return The display name shown for the user in AWS CodeStar projects. For example, this could be set to both
* first and last name ("Mary Major") or a single name ("Mary"). The display name is also used to generate
* the initial icon associated with the user in AWS CodeStar projects. If spaces are included in the display
* name, the first character that appears after the space will be used as the second character in the user
* initial icon. The initial icon displays a maximum of two characters, so a display name with more than one
* space (for example "Mary Jane Major") would generate an initial icon using the first character and the
* first character after the space ("MJ", not "MM").
*/
public final String displayName() {
return displayName;
}
/**
*
* The email address for the user. Optional.
*
*
* @return The email address for the user. Optional.
*/
public final String emailAddress() {
return emailAddress;
}
/**
*
* The SSH public key associated with the user. This SSH public key is associated with the user profile, and can be
* used in conjunction with the associated private key for access to project resources, such as Amazon EC2
* instances, if a project owner grants remote access to those resources.
*
*
* @return The SSH public key associated with the user. This SSH public key is associated with the user profile, and
* can be used in conjunction with the associated private key for access to project resources, such as
* Amazon EC2 instances, if a project owner grants remote access to those resources.
*/
public final String sshPublicKey() {
return sshPublicKey;
}
/**
*
* The date and time when the user profile was created in AWS CodeStar, in timestamp format.
*
*
* @return The date and time when the user profile was created in AWS CodeStar, in timestamp format.
*/
public final Instant createdTimestamp() {
return createdTimestamp;
}
/**
*
* The date and time when the user profile was last modified, in timestamp format.
*
*
* @return The date and time when the user profile was last modified, in timestamp format.
*/
public final Instant lastModifiedTimestamp() {
return lastModifiedTimestamp;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(userArn());
hashCode = 31 * hashCode + Objects.hashCode(displayName());
hashCode = 31 * hashCode + Objects.hashCode(emailAddress());
hashCode = 31 * hashCode + Objects.hashCode(sshPublicKey());
hashCode = 31 * hashCode + Objects.hashCode(createdTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTimestamp());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeUserProfileResponse)) {
return false;
}
DescribeUserProfileResponse other = (DescribeUserProfileResponse) obj;
return Objects.equals(userArn(), other.userArn()) && Objects.equals(displayName(), other.displayName())
&& Objects.equals(emailAddress(), other.emailAddress()) && Objects.equals(sshPublicKey(), other.sshPublicKey())
&& Objects.equals(createdTimestamp(), other.createdTimestamp())
&& Objects.equals(lastModifiedTimestamp(), other.lastModifiedTimestamp());
}
/**
* 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("DescribeUserProfileResponse").add("UserArn", userArn())
.add("DisplayName", displayName() == null ? null : "*** Sensitive Data Redacted ***")
.add("EmailAddress", emailAddress() == null ? null : "*** Sensitive Data Redacted ***")
.add("SshPublicKey", sshPublicKey()).add("CreatedTimestamp", createdTimestamp())
.add("LastModifiedTimestamp", lastModifiedTimestamp()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "userArn":
return Optional.ofNullable(clazz.cast(userArn()));
case "displayName":
return Optional.ofNullable(clazz.cast(displayName()));
case "emailAddress":
return Optional.ofNullable(clazz.cast(emailAddress()));
case "sshPublicKey":
return Optional.ofNullable(clazz.cast(sshPublicKey()));
case "createdTimestamp":
return Optional.ofNullable(clazz.cast(createdTimestamp()));
case "lastModifiedTimestamp":
return Optional.ofNullable(clazz.cast(lastModifiedTimestamp()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function