software.amazon.awssdk.services.sagemaker.model.IdleSettings Maven / Gradle / Ivy
Show all versions of sagemaker 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.sagemaker.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;
/**
*
* Settings related to idle shutdown of Studio applications.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class IdleSettings implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField LIFECYCLE_MANAGEMENT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LifecycleManagement").getter(getter(IdleSettings::lifecycleManagementAsString))
.setter(setter(Builder::lifecycleManagement))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LifecycleManagement").build())
.build();
private static final SdkField IDLE_TIMEOUT_IN_MINUTES_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("IdleTimeoutInMinutes").getter(getter(IdleSettings::idleTimeoutInMinutes))
.setter(setter(Builder::idleTimeoutInMinutes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IdleTimeoutInMinutes").build())
.build();
private static final SdkField MIN_IDLE_TIMEOUT_IN_MINUTES_FIELD = SdkField
. builder(MarshallingType.INTEGER).memberName("MinIdleTimeoutInMinutes")
.getter(getter(IdleSettings::minIdleTimeoutInMinutes)).setter(setter(Builder::minIdleTimeoutInMinutes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MinIdleTimeoutInMinutes").build())
.build();
private static final SdkField MAX_IDLE_TIMEOUT_IN_MINUTES_FIELD = SdkField
. builder(MarshallingType.INTEGER).memberName("MaxIdleTimeoutInMinutes")
.getter(getter(IdleSettings::maxIdleTimeoutInMinutes)).setter(setter(Builder::maxIdleTimeoutInMinutes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxIdleTimeoutInMinutes").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LIFECYCLE_MANAGEMENT_FIELD,
IDLE_TIMEOUT_IN_MINUTES_FIELD, MIN_IDLE_TIMEOUT_IN_MINUTES_FIELD, MAX_IDLE_TIMEOUT_IN_MINUTES_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String lifecycleManagement;
private final Integer idleTimeoutInMinutes;
private final Integer minIdleTimeoutInMinutes;
private final Integer maxIdleTimeoutInMinutes;
private IdleSettings(BuilderImpl builder) {
this.lifecycleManagement = builder.lifecycleManagement;
this.idleTimeoutInMinutes = builder.idleTimeoutInMinutes;
this.minIdleTimeoutInMinutes = builder.minIdleTimeoutInMinutes;
this.maxIdleTimeoutInMinutes = builder.maxIdleTimeoutInMinutes;
}
/**
*
* Indicates whether idle shutdown is activated for the application type.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #lifecycleManagement} will return {@link LifecycleManagement#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #lifecycleManagementAsString}.
*
*
* @return Indicates whether idle shutdown is activated for the application type.
* @see LifecycleManagement
*/
public final LifecycleManagement lifecycleManagement() {
return LifecycleManagement.fromValue(lifecycleManagement);
}
/**
*
* Indicates whether idle shutdown is activated for the application type.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #lifecycleManagement} will return {@link LifecycleManagement#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #lifecycleManagementAsString}.
*
*
* @return Indicates whether idle shutdown is activated for the application type.
* @see LifecycleManagement
*/
public final String lifecycleManagementAsString() {
return lifecycleManagement;
}
/**
*
* The time that SageMaker waits after the application becomes idle before shutting it down.
*
*
* @return The time that SageMaker waits after the application becomes idle before shutting it down.
*/
public final Integer idleTimeoutInMinutes() {
return idleTimeoutInMinutes;
}
/**
*
* The minimum value in minutes that custom idle shutdown can be set to by the user.
*
*
* @return The minimum value in minutes that custom idle shutdown can be set to by the user.
*/
public final Integer minIdleTimeoutInMinutes() {
return minIdleTimeoutInMinutes;
}
/**
*
* The maximum value in minutes that custom idle shutdown can be set to by the user.
*
*
* @return The maximum value in minutes that custom idle shutdown can be set to by the user.
*/
public final Integer maxIdleTimeoutInMinutes() {
return maxIdleTimeoutInMinutes;
}
@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(lifecycleManagementAsString());
hashCode = 31 * hashCode + Objects.hashCode(idleTimeoutInMinutes());
hashCode = 31 * hashCode + Objects.hashCode(minIdleTimeoutInMinutes());
hashCode = 31 * hashCode + Objects.hashCode(maxIdleTimeoutInMinutes());
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 IdleSettings)) {
return false;
}
IdleSettings other = (IdleSettings) obj;
return Objects.equals(lifecycleManagementAsString(), other.lifecycleManagementAsString())
&& Objects.equals(idleTimeoutInMinutes(), other.idleTimeoutInMinutes())
&& Objects.equals(minIdleTimeoutInMinutes(), other.minIdleTimeoutInMinutes())
&& Objects.equals(maxIdleTimeoutInMinutes(), other.maxIdleTimeoutInMinutes());
}
/**
* 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("IdleSettings").add("LifecycleManagement", lifecycleManagementAsString())
.add("IdleTimeoutInMinutes", idleTimeoutInMinutes()).add("MinIdleTimeoutInMinutes", minIdleTimeoutInMinutes())
.add("MaxIdleTimeoutInMinutes", maxIdleTimeoutInMinutes()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "LifecycleManagement":
return Optional.ofNullable(clazz.cast(lifecycleManagementAsString()));
case "IdleTimeoutInMinutes":
return Optional.ofNullable(clazz.cast(idleTimeoutInMinutes()));
case "MinIdleTimeoutInMinutes":
return Optional.ofNullable(clazz.cast(minIdleTimeoutInMinutes()));
case "MaxIdleTimeoutInMinutes":
return Optional.ofNullable(clazz.cast(maxIdleTimeoutInMinutes()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("LifecycleManagement", LIFECYCLE_MANAGEMENT_FIELD);
map.put("IdleTimeoutInMinutes", IDLE_TIMEOUT_IN_MINUTES_FIELD);
map.put("MinIdleTimeoutInMinutes", MIN_IDLE_TIMEOUT_IN_MINUTES_FIELD);
map.put("MaxIdleTimeoutInMinutes", MAX_IDLE_TIMEOUT_IN_MINUTES_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function