software.amazon.awssdk.services.codedeploy.model.ApplicationInfo 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.codedeploy.model;
import java.beans.Transient;
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;
/**
*
* Information about an application.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ApplicationInfo implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField APPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("applicationId").getter(getter(ApplicationInfo::applicationId)).setter(setter(Builder::applicationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("applicationId").build()).build();
private static final SdkField APPLICATION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("applicationName").getter(getter(ApplicationInfo::applicationName))
.setter(setter(Builder::applicationName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("applicationName").build()).build();
private static final SdkField CREATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("createTime").getter(getter(ApplicationInfo::createTime)).setter(setter(Builder::createTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createTime").build()).build();
private static final SdkField LINKED_TO_GIT_HUB_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("linkedToGitHub").getter(getter(ApplicationInfo::linkedToGitHub)).setter(setter(Builder::linkedToGitHub))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("linkedToGitHub").build()).build();
private static final SdkField GIT_HUB_ACCOUNT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("gitHubAccountName").getter(getter(ApplicationInfo::gitHubAccountName))
.setter(setter(Builder::gitHubAccountName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("gitHubAccountName").build()).build();
private static final SdkField COMPUTE_PLATFORM_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("computePlatform").getter(getter(ApplicationInfo::computePlatformAsString))
.setter(setter(Builder::computePlatform))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("computePlatform").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APPLICATION_ID_FIELD,
APPLICATION_NAME_FIELD, CREATE_TIME_FIELD, LINKED_TO_GIT_HUB_FIELD, GIT_HUB_ACCOUNT_NAME_FIELD,
COMPUTE_PLATFORM_FIELD));
private static final long serialVersionUID = 1L;
private final String applicationId;
private final String applicationName;
private final Instant createTime;
private final Boolean linkedToGitHub;
private final String gitHubAccountName;
private final String computePlatform;
private ApplicationInfo(BuilderImpl builder) {
this.applicationId = builder.applicationId;
this.applicationName = builder.applicationName;
this.createTime = builder.createTime;
this.linkedToGitHub = builder.linkedToGitHub;
this.gitHubAccountName = builder.gitHubAccountName;
this.computePlatform = builder.computePlatform;
}
/**
*
* The application ID.
*
*
* @return The application ID.
*/
public final String applicationId() {
return applicationId;
}
/**
*
* The application name.
*
*
* @return The application name.
*/
public final String applicationName() {
return applicationName;
}
/**
*
* The time at which the application was created.
*
*
* @return The time at which the application was created.
*/
public final Instant createTime() {
return createTime;
}
/**
*
* True if the user has authenticated with GitHub for the specified application. Otherwise, false.
*
*
* @return True if the user has authenticated with GitHub for the specified application. Otherwise, false.
*/
public final Boolean linkedToGitHub() {
return linkedToGitHub;
}
/**
*
* The name for a connection to a GitHub account.
*
*
* @return The name for a connection to a GitHub account.
*/
public final String gitHubAccountName() {
return gitHubAccountName;
}
/**
*
* The destination platform type for deployment of the application (Lambda
or Server
).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #computePlatform}
* will return {@link ComputePlatform#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #computePlatformAsString}.
*
*
* @return The destination platform type for deployment of the application (Lambda
or
* Server
).
* @see ComputePlatform
*/
public final ComputePlatform computePlatform() {
return ComputePlatform.fromValue(computePlatform);
}
/**
*
* The destination platform type for deployment of the application (Lambda
or Server
).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #computePlatform}
* will return {@link ComputePlatform#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #computePlatformAsString}.
*
*
* @return The destination platform type for deployment of the application (Lambda
or
* Server
).
* @see ComputePlatform
*/
public final String computePlatformAsString() {
return computePlatform;
}
@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(applicationId());
hashCode = 31 * hashCode + Objects.hashCode(applicationName());
hashCode = 31 * hashCode + Objects.hashCode(createTime());
hashCode = 31 * hashCode + Objects.hashCode(linkedToGitHub());
hashCode = 31 * hashCode + Objects.hashCode(gitHubAccountName());
hashCode = 31 * hashCode + Objects.hashCode(computePlatformAsString());
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 ApplicationInfo)) {
return false;
}
ApplicationInfo other = (ApplicationInfo) obj;
return Objects.equals(applicationId(), other.applicationId())
&& Objects.equals(applicationName(), other.applicationName()) && Objects.equals(createTime(), other.createTime())
&& Objects.equals(linkedToGitHub(), other.linkedToGitHub())
&& Objects.equals(gitHubAccountName(), other.gitHubAccountName())
&& Objects.equals(computePlatformAsString(), other.computePlatformAsString());
}
/**
* 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("ApplicationInfo").add("ApplicationId", applicationId())
.add("ApplicationName", applicationName()).add("CreateTime", createTime())
.add("LinkedToGitHub", linkedToGitHub()).add("GitHubAccountName", gitHubAccountName())
.add("ComputePlatform", computePlatformAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "applicationId":
return Optional.ofNullable(clazz.cast(applicationId()));
case "applicationName":
return Optional.ofNullable(clazz.cast(applicationName()));
case "createTime":
return Optional.ofNullable(clazz.cast(createTime()));
case "linkedToGitHub":
return Optional.ofNullable(clazz.cast(linkedToGitHub()));
case "gitHubAccountName":
return Optional.ofNullable(clazz.cast(gitHubAccountName()));
case "computePlatform":
return Optional.ofNullable(clazz.cast(computePlatformAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function