
software.amazon.awssdk.services.ssmsap.model.Application 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.ssmsap.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* An SAP application registered with AWS Systems Manager for SAP.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Application implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(Application::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type")
.getter(getter(Application::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(Application::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField APP_REGISTRY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AppRegistryArn").getter(getter(Application::appRegistryArn)).setter(setter(Builder::appRegistryArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AppRegistryArn").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(Application::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField DISCOVERY_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DiscoveryStatus").getter(getter(Application::discoveryStatusAsString))
.setter(setter(Builder::discoveryStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DiscoveryStatus").build()).build();
private static final SdkField> COMPONENTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Components")
.getter(getter(Application::components))
.setter(setter(Builder::components))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Components").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField LAST_UPDATED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdated").getter(getter(Application::lastUpdated)).setter(setter(Builder::lastUpdated))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdated").build()).build();
private static final SdkField STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StatusMessage").getter(getter(Application::statusMessage)).setter(setter(Builder::statusMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusMessage").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, TYPE_FIELD,
ARN_FIELD, APP_REGISTRY_ARN_FIELD, STATUS_FIELD, DISCOVERY_STATUS_FIELD, COMPONENTS_FIELD, LAST_UPDATED_FIELD,
STATUS_MESSAGE_FIELD));
private static final long serialVersionUID = 1L;
private final String id;
private final String type;
private final String arn;
private final String appRegistryArn;
private final String status;
private final String discoveryStatus;
private final List components;
private final Instant lastUpdated;
private final String statusMessage;
private Application(BuilderImpl builder) {
this.id = builder.id;
this.type = builder.type;
this.arn = builder.arn;
this.appRegistryArn = builder.appRegistryArn;
this.status = builder.status;
this.discoveryStatus = builder.discoveryStatus;
this.components = builder.components;
this.lastUpdated = builder.lastUpdated;
this.statusMessage = builder.statusMessage;
}
/**
*
* The ID of the application.
*
*
* @return The ID of the application.
*/
public final String id() {
return id;
}
/**
*
* The type of the application.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link ApplicationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of the application.
* @see ApplicationType
*/
public final ApplicationType type() {
return ApplicationType.fromValue(type);
}
/**
*
* The type of the application.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link ApplicationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of the application.
* @see ApplicationType
*/
public final String typeAsString() {
return type;
}
/**
*
* The Amazon Resource Name (ARN) of the application.
*
*
* @return The Amazon Resource Name (ARN) of the application.
*/
public final String arn() {
return arn;
}
/**
*
* The Amazon Resource Name (ARN) of the Application Registry.
*
*
* @return The Amazon Resource Name (ARN) of the Application Registry.
*/
public final String appRegistryArn() {
return appRegistryArn;
}
/**
*
* The status of the application.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ApplicationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the application.
* @see ApplicationStatus
*/
public final ApplicationStatus status() {
return ApplicationStatus.fromValue(status);
}
/**
*
* The status of the application.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ApplicationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the application.
* @see ApplicationStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The latest discovery result for the application.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #discoveryStatus}
* will return {@link ApplicationDiscoveryStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #discoveryStatusAsString}.
*
*
* @return The latest discovery result for the application.
* @see ApplicationDiscoveryStatus
*/
public final ApplicationDiscoveryStatus discoveryStatus() {
return ApplicationDiscoveryStatus.fromValue(discoveryStatus);
}
/**
*
* The latest discovery result for the application.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #discoveryStatus}
* will return {@link ApplicationDiscoveryStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #discoveryStatusAsString}.
*
*
* @return The latest discovery result for the application.
* @see ApplicationDiscoveryStatus
*/
public final String discoveryStatusAsString() {
return discoveryStatus;
}
/**
* For responses, this returns true if the service returned a value for the Components property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasComponents() {
return components != null && !(components instanceof SdkAutoConstructList);
}
/**
*
* The components of the application.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasComponents} method.
*
*
* @return The components of the application.
*/
public final List components() {
return components;
}
/**
*
* The time at which the application was last updated.
*
*
* @return The time at which the application was last updated.
*/
public final Instant lastUpdated() {
return lastUpdated;
}
/**
*
* The status message.
*
*
* @return The status message.
*/
public final String statusMessage() {
return statusMessage;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(typeAsString());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(appRegistryArn());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(discoveryStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasComponents() ? components() : null);
hashCode = 31 * hashCode + Objects.hashCode(lastUpdated());
hashCode = 31 * hashCode + Objects.hashCode(statusMessage());
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 Application)) {
return false;
}
Application other = (Application) obj;
return Objects.equals(id(), other.id()) && Objects.equals(typeAsString(), other.typeAsString())
&& Objects.equals(arn(), other.arn()) && Objects.equals(appRegistryArn(), other.appRegistryArn())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(discoveryStatusAsString(), other.discoveryStatusAsString())
&& hasComponents() == other.hasComponents() && Objects.equals(components(), other.components())
&& Objects.equals(lastUpdated(), other.lastUpdated()) && Objects.equals(statusMessage(), other.statusMessage());
}
/**
* 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("Application").add("Id", id()).add("Type", typeAsString()).add("Arn", arn())
.add("AppRegistryArn", appRegistryArn()).add("Status", statusAsString())
.add("DiscoveryStatus", discoveryStatusAsString()).add("Components", hasComponents() ? components() : null)
.add("LastUpdated", lastUpdated()).add("StatusMessage", statusMessage()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Type":
return Optional.ofNullable(clazz.cast(typeAsString()));
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "AppRegistryArn":
return Optional.ofNullable(clazz.cast(appRegistryArn()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "DiscoveryStatus":
return Optional.ofNullable(clazz.cast(discoveryStatusAsString()));
case "Components":
return Optional.ofNullable(clazz.cast(components()));
case "LastUpdated":
return Optional.ofNullable(clazz.cast(lastUpdated()));
case "StatusMessage":
return Optional.ofNullable(clazz.cast(statusMessage()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function