software.amazon.awssdk.services.sagemaker.model.ModelDashboardModelCard 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.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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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;
/**
*
* The model card for a model displayed in the Amazon SageMaker Model Dashboard.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ModelDashboardModelCard implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField MODEL_CARD_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ModelCardArn").getter(getter(ModelDashboardModelCard::modelCardArn))
.setter(setter(Builder::modelCardArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModelCardArn").build()).build();
private static final SdkField MODEL_CARD_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ModelCardName").getter(getter(ModelDashboardModelCard::modelCardName))
.setter(setter(Builder::modelCardName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModelCardName").build()).build();
private static final SdkField MODEL_CARD_VERSION_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("ModelCardVersion").getter(getter(ModelDashboardModelCard::modelCardVersion))
.setter(setter(Builder::modelCardVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModelCardVersion").build()).build();
private static final SdkField MODEL_CARD_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ModelCardStatus").getter(getter(ModelDashboardModelCard::modelCardStatusAsString))
.setter(setter(Builder::modelCardStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModelCardStatus").build()).build();
private static final SdkField SECURITY_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("SecurityConfig")
.getter(getter(ModelDashboardModelCard::securityConfig)).setter(setter(Builder::securityConfig))
.constructor(ModelCardSecurityConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SecurityConfig").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(ModelDashboardModelCard::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField CREATED_BY_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("CreatedBy").getter(getter(ModelDashboardModelCard::createdBy)).setter(setter(Builder::createdBy))
.constructor(UserContext::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedBy").build()).build();
private static final SdkField LAST_MODIFIED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastModifiedTime").getter(getter(ModelDashboardModelCard::lastModifiedTime))
.setter(setter(Builder::lastModifiedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedTime").build()).build();
private static final SdkField LAST_MODIFIED_BY_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("LastModifiedBy").getter(getter(ModelDashboardModelCard::lastModifiedBy))
.setter(setter(Builder::lastModifiedBy)).constructor(UserContext::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedBy").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(ModelDashboardModelCard::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField MODEL_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ModelId").getter(getter(ModelDashboardModelCard::modelId)).setter(setter(Builder::modelId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModelId").build()).build();
private static final SdkField RISK_RATING_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RiskRating").getter(getter(ModelDashboardModelCard::riskRating)).setter(setter(Builder::riskRating))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RiskRating").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MODEL_CARD_ARN_FIELD,
MODEL_CARD_NAME_FIELD, MODEL_CARD_VERSION_FIELD, MODEL_CARD_STATUS_FIELD, SECURITY_CONFIG_FIELD, CREATION_TIME_FIELD,
CREATED_BY_FIELD, LAST_MODIFIED_TIME_FIELD, LAST_MODIFIED_BY_FIELD, TAGS_FIELD, MODEL_ID_FIELD, RISK_RATING_FIELD));
private static final long serialVersionUID = 1L;
private final String modelCardArn;
private final String modelCardName;
private final Integer modelCardVersion;
private final String modelCardStatus;
private final ModelCardSecurityConfig securityConfig;
private final Instant creationTime;
private final UserContext createdBy;
private final Instant lastModifiedTime;
private final UserContext lastModifiedBy;
private final List tags;
private final String modelId;
private final String riskRating;
private ModelDashboardModelCard(BuilderImpl builder) {
this.modelCardArn = builder.modelCardArn;
this.modelCardName = builder.modelCardName;
this.modelCardVersion = builder.modelCardVersion;
this.modelCardStatus = builder.modelCardStatus;
this.securityConfig = builder.securityConfig;
this.creationTime = builder.creationTime;
this.createdBy = builder.createdBy;
this.lastModifiedTime = builder.lastModifiedTime;
this.lastModifiedBy = builder.lastModifiedBy;
this.tags = builder.tags;
this.modelId = builder.modelId;
this.riskRating = builder.riskRating;
}
/**
*
* The Amazon Resource Name (ARN) for a model card.
*
*
* @return The Amazon Resource Name (ARN) for a model card.
*/
public final String modelCardArn() {
return modelCardArn;
}
/**
*
* The name of a model card.
*
*
* @return The name of a model card.
*/
public final String modelCardName() {
return modelCardName;
}
/**
*
* The model card version.
*
*
* @return The model card version.
*/
public final Integer modelCardVersion() {
return modelCardVersion;
}
/**
*
* The model card status.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #modelCardStatus}
* will return {@link ModelCardStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #modelCardStatusAsString}.
*
*
* @return The model card status.
* @see ModelCardStatus
*/
public final ModelCardStatus modelCardStatus() {
return ModelCardStatus.fromValue(modelCardStatus);
}
/**
*
* The model card status.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #modelCardStatus}
* will return {@link ModelCardStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #modelCardStatusAsString}.
*
*
* @return The model card status.
* @see ModelCardStatus
*/
public final String modelCardStatusAsString() {
return modelCardStatus;
}
/**
*
* The KMS Key ID (KMSKeyId
) for encryption of model card information.
*
*
* @return The KMS Key ID (KMSKeyId
) for encryption of model card information.
*/
public final ModelCardSecurityConfig securityConfig() {
return securityConfig;
}
/**
*
* A timestamp that indicates when the model card was created.
*
*
* @return A timestamp that indicates when the model card was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
* Returns the value of the CreatedBy property for this object.
*
* @return The value of the CreatedBy property for this object.
*/
public final UserContext createdBy() {
return createdBy;
}
/**
*
* A timestamp that indicates when the model card was last updated.
*
*
* @return A timestamp that indicates when the model card was last updated.
*/
public final Instant lastModifiedTime() {
return lastModifiedTime;
}
/**
* Returns the value of the LastModifiedBy property for this object.
*
* @return The value of the LastModifiedBy property for this object.
*/
public final UserContext lastModifiedBy() {
return lastModifiedBy;
}
/**
* For responses, this returns true if the service returned a value for the Tags 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 hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* The tags associated with a model card.
*
*
* 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 #hasTags} method.
*
*
* @return The tags associated with a model card.
*/
public final List tags() {
return tags;
}
/**
*
* For models created in SageMaker, this is the model ARN. For models created outside of SageMaker, this is a
* user-customized string.
*
*
* @return For models created in SageMaker, this is the model ARN. For models created outside of SageMaker, this is
* a user-customized string.
*/
public final String modelId() {
return modelId;
}
/**
*
* A model card's risk rating. Can be low, medium, or high.
*
*
* @return A model card's risk rating. Can be low, medium, or high.
*/
public final String riskRating() {
return riskRating;
}
@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(modelCardArn());
hashCode = 31 * hashCode + Objects.hashCode(modelCardName());
hashCode = 31 * hashCode + Objects.hashCode(modelCardVersion());
hashCode = 31 * hashCode + Objects.hashCode(modelCardStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(securityConfig());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(createdBy());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedBy());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(modelId());
hashCode = 31 * hashCode + Objects.hashCode(riskRating());
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 ModelDashboardModelCard)) {
return false;
}
ModelDashboardModelCard other = (ModelDashboardModelCard) obj;
return Objects.equals(modelCardArn(), other.modelCardArn()) && Objects.equals(modelCardName(), other.modelCardName())
&& Objects.equals(modelCardVersion(), other.modelCardVersion())
&& Objects.equals(modelCardStatusAsString(), other.modelCardStatusAsString())
&& Objects.equals(securityConfig(), other.securityConfig())
&& Objects.equals(creationTime(), other.creationTime()) && Objects.equals(createdBy(), other.createdBy())
&& Objects.equals(lastModifiedTime(), other.lastModifiedTime())
&& Objects.equals(lastModifiedBy(), other.lastModifiedBy()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags()) && Objects.equals(modelId(), other.modelId())
&& Objects.equals(riskRating(), other.riskRating());
}
/**
* 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("ModelDashboardModelCard").add("ModelCardArn", modelCardArn())
.add("ModelCardName", modelCardName()).add("ModelCardVersion", modelCardVersion())
.add("ModelCardStatus", modelCardStatusAsString()).add("SecurityConfig", securityConfig())
.add("CreationTime", creationTime()).add("CreatedBy", createdBy()).add("LastModifiedTime", lastModifiedTime())
.add("LastModifiedBy", lastModifiedBy()).add("Tags", hasTags() ? tags() : null).add("ModelId", modelId())
.add("RiskRating", riskRating()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ModelCardArn":
return Optional.ofNullable(clazz.cast(modelCardArn()));
case "ModelCardName":
return Optional.ofNullable(clazz.cast(modelCardName()));
case "ModelCardVersion":
return Optional.ofNullable(clazz.cast(modelCardVersion()));
case "ModelCardStatus":
return Optional.ofNullable(clazz.cast(modelCardStatusAsString()));
case "SecurityConfig":
return Optional.ofNullable(clazz.cast(securityConfig()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "CreatedBy":
return Optional.ofNullable(clazz.cast(createdBy()));
case "LastModifiedTime":
return Optional.ofNullable(clazz.cast(lastModifiedTime()));
case "LastModifiedBy":
return Optional.ofNullable(clazz.cast(lastModifiedBy()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
case "ModelId":
return Optional.ofNullable(clazz.cast(modelId()));
case "RiskRating":
return Optional.ofNullable(clazz.cast(riskRating()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function