software.amazon.awssdk.services.apprunner.model.AutoScalingConfigurationSummary Maven / Gradle / Ivy
Show all versions of apprunner Show documentation
/*
* 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.apprunner.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;
/**
*
* Provides summary information about an App Runner automatic scaling configuration resource.
*
*
* This type contains limited information about an auto scaling configuration. It includes only identification
* information, without configuration details. It's returned by the ListAutoScalingConfigurations action.
* Complete configuration information is returned by the CreateAutoScalingConfiguration,
* DescribeAutoScalingConfiguration, and DeleteAutoScalingConfiguration actions using the
* AutoScalingConfiguration type.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AutoScalingConfigurationSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField AUTO_SCALING_CONFIGURATION_ARN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("AutoScalingConfigurationArn")
.getter(getter(AutoScalingConfigurationSummary::autoScalingConfigurationArn))
.setter(setter(Builder::autoScalingConfigurationArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoScalingConfigurationArn")
.build()).build();
private static final SdkField AUTO_SCALING_CONFIGURATION_NAME_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("AutoScalingConfigurationName")
.getter(getter(AutoScalingConfigurationSummary::autoScalingConfigurationName))
.setter(setter(Builder::autoScalingConfigurationName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoScalingConfigurationName")
.build()).build();
private static final SdkField AUTO_SCALING_CONFIGURATION_REVISION_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("AutoScalingConfigurationRevision")
.getter(getter(AutoScalingConfigurationSummary::autoScalingConfigurationRevision))
.setter(setter(Builder::autoScalingConfigurationRevision))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoScalingConfigurationRevision")
.build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(AutoScalingConfigurationSummary::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedAt").getter(getter(AutoScalingConfigurationSummary::createdAt))
.setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedAt").build()).build();
private static final SdkField HAS_ASSOCIATED_SERVICE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("HasAssociatedService").getter(getter(AutoScalingConfigurationSummary::hasAssociatedService))
.setter(setter(Builder::hasAssociatedService))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HasAssociatedService").build())
.build();
private static final SdkField IS_DEFAULT_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("IsDefault").getter(getter(AutoScalingConfigurationSummary::isDefault))
.setter(setter(Builder::isDefault))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsDefault").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
AUTO_SCALING_CONFIGURATION_ARN_FIELD, AUTO_SCALING_CONFIGURATION_NAME_FIELD,
AUTO_SCALING_CONFIGURATION_REVISION_FIELD, STATUS_FIELD, CREATED_AT_FIELD, HAS_ASSOCIATED_SERVICE_FIELD,
IS_DEFAULT_FIELD));
private static final long serialVersionUID = 1L;
private final String autoScalingConfigurationArn;
private final String autoScalingConfigurationName;
private final Integer autoScalingConfigurationRevision;
private final String status;
private final Instant createdAt;
private final Boolean hasAssociatedService;
private final Boolean isDefault;
private AutoScalingConfigurationSummary(BuilderImpl builder) {
this.autoScalingConfigurationArn = builder.autoScalingConfigurationArn;
this.autoScalingConfigurationName = builder.autoScalingConfigurationName;
this.autoScalingConfigurationRevision = builder.autoScalingConfigurationRevision;
this.status = builder.status;
this.createdAt = builder.createdAt;
this.hasAssociatedService = builder.hasAssociatedService;
this.isDefault = builder.isDefault;
}
/**
*
* The Amazon Resource Name (ARN) of this auto scaling configuration.
*
*
* @return The Amazon Resource Name (ARN) of this auto scaling configuration.
*/
public final String autoScalingConfigurationArn() {
return autoScalingConfigurationArn;
}
/**
*
* The customer-provided auto scaling configuration name. It can be used in multiple revisions of a configuration.
*
*
* @return The customer-provided auto scaling configuration name. It can be used in multiple revisions of a
* configuration.
*/
public final String autoScalingConfigurationName() {
return autoScalingConfigurationName;
}
/**
*
* The revision of this auto scaling configuration. It's unique among all the active configurations (
* "Status": "ACTIVE"
) with the same AutoScalingConfigurationName
.
*
*
* @return The revision of this auto scaling configuration. It's unique among all the active configurations (
* "Status": "ACTIVE"
) with the same AutoScalingConfigurationName
.
*/
public final Integer autoScalingConfigurationRevision() {
return autoScalingConfigurationRevision;
}
/**
*
* The current state of the auto scaling configuration. If the status of a configuration revision is
* INACTIVE
, it was deleted and can't be used. Inactive configuration revisions are permanently removed
* some time after they are deleted.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link AutoScalingConfigurationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusAsString}.
*
*
* @return The current state of the auto scaling configuration. If the status of a configuration revision is
* INACTIVE
, it was deleted and can't be used. Inactive configuration revisions are permanently
* removed some time after they are deleted.
* @see AutoScalingConfigurationStatus
*/
public final AutoScalingConfigurationStatus status() {
return AutoScalingConfigurationStatus.fromValue(status);
}
/**
*
* The current state of the auto scaling configuration. If the status of a configuration revision is
* INACTIVE
, it was deleted and can't be used. Inactive configuration revisions are permanently removed
* some time after they are deleted.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link AutoScalingConfigurationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusAsString}.
*
*
* @return The current state of the auto scaling configuration. If the status of a configuration revision is
* INACTIVE
, it was deleted and can't be used. Inactive configuration revisions are permanently
* removed some time after they are deleted.
* @see AutoScalingConfigurationStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The time when the auto scaling configuration was created. It's in Unix time stamp format.
*
*
* @return The time when the auto scaling configuration was created. It's in Unix time stamp format.
*/
public final Instant createdAt() {
return createdAt;
}
/**
*
* Indicates if this auto scaling configuration has an App Runner service associated with it. A value of
* true
indicates one or more services are associated. A value of false
indicates no
* services are associated.
*
*
* @return Indicates if this auto scaling configuration has an App Runner service associated with it. A value of
* true
indicates one or more services are associated. A value of false
indicates
* no services are associated.
*/
public final Boolean hasAssociatedService() {
return hasAssociatedService;
}
/**
*
* Indicates if this auto scaling configuration should be used as the default for a new App Runner service that does
* not have an auto scaling configuration ARN specified during creation. Each account can have only one default
* AutoScalingConfiguration
per region. The default AutoScalingConfiguration
can be any
* revision under the same AutoScalingConfigurationName
.
*
*
* @return Indicates if this auto scaling configuration should be used as the default for a new App Runner service
* that does not have an auto scaling configuration ARN specified during creation. Each account can have
* only one default AutoScalingConfiguration
per region. The default
* AutoScalingConfiguration
can be any revision under the same
* AutoScalingConfigurationName
.
*/
public final Boolean isDefault() {
return isDefault;
}
@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(autoScalingConfigurationArn());
hashCode = 31 * hashCode + Objects.hashCode(autoScalingConfigurationName());
hashCode = 31 * hashCode + Objects.hashCode(autoScalingConfigurationRevision());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(hasAssociatedService());
hashCode = 31 * hashCode + Objects.hashCode(isDefault());
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 AutoScalingConfigurationSummary)) {
return false;
}
AutoScalingConfigurationSummary other = (AutoScalingConfigurationSummary) obj;
return Objects.equals(autoScalingConfigurationArn(), other.autoScalingConfigurationArn())
&& Objects.equals(autoScalingConfigurationName(), other.autoScalingConfigurationName())
&& Objects.equals(autoScalingConfigurationRevision(), other.autoScalingConfigurationRevision())
&& Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(createdAt(), other.createdAt())
&& Objects.equals(hasAssociatedService(), other.hasAssociatedService())
&& Objects.equals(isDefault(), other.isDefault());
}
/**
* 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("AutoScalingConfigurationSummary")
.add("AutoScalingConfigurationArn", autoScalingConfigurationArn())
.add("AutoScalingConfigurationName", autoScalingConfigurationName())
.add("AutoScalingConfigurationRevision", autoScalingConfigurationRevision()).add("Status", statusAsString())
.add("CreatedAt", createdAt()).add("HasAssociatedService", hasAssociatedService()).add("IsDefault", isDefault())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AutoScalingConfigurationArn":
return Optional.ofNullable(clazz.cast(autoScalingConfigurationArn()));
case "AutoScalingConfigurationName":
return Optional.ofNullable(clazz.cast(autoScalingConfigurationName()));
case "AutoScalingConfigurationRevision":
return Optional.ofNullable(clazz.cast(autoScalingConfigurationRevision()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "CreatedAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "HasAssociatedService":
return Optional.ofNullable(clazz.cast(hasAssociatedService()));
case "IsDefault":
return Optional.ofNullable(clazz.cast(isDefault()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function