All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.sagemaker.model.ModelDashboardModel 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.sagemaker.model;

import java.io.Serializable;
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;

/**
 * 

* A model displayed in the Amazon SageMaker Model Dashboard. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ModelDashboardModel implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField MODEL_FIELD = SdkField. builder(MarshallingType.SDK_POJO).memberName("Model") .getter(getter(ModelDashboardModel::model)).setter(setter(Builder::model)).constructor(Model::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Model").build()).build(); private static final SdkField> ENDPOINTS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Endpoints") .getter(getter(ModelDashboardModel::endpoints)) .setter(setter(Builder::endpoints)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Endpoints").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ModelDashboardEndpoint::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField LAST_BATCH_TRANSFORM_JOB_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("LastBatchTransformJob") .getter(getter(ModelDashboardModel::lastBatchTransformJob)).setter(setter(Builder::lastBatchTransformJob)) .constructor(TransformJob::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastBatchTransformJob").build()) .build(); private static final SdkField> MONITORING_SCHEDULES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("MonitoringSchedules") .getter(getter(ModelDashboardModel::monitoringSchedules)) .setter(setter(Builder::monitoringSchedules)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MonitoringSchedules").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ModelDashboardMonitoringSchedule::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField MODEL_CARD_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("ModelCard") .getter(getter(ModelDashboardModel::modelCard)).setter(setter(Builder::modelCard)) .constructor(ModelDashboardModelCard::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModelCard").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MODEL_FIELD, ENDPOINTS_FIELD, LAST_BATCH_TRANSFORM_JOB_FIELD, MONITORING_SCHEDULES_FIELD, MODEL_CARD_FIELD)); private static final long serialVersionUID = 1L; private final Model model; private final List endpoints; private final TransformJob lastBatchTransformJob; private final List monitoringSchedules; private final ModelDashboardModelCard modelCard; private ModelDashboardModel(BuilderImpl builder) { this.model = builder.model; this.endpoints = builder.endpoints; this.lastBatchTransformJob = builder.lastBatchTransformJob; this.monitoringSchedules = builder.monitoringSchedules; this.modelCard = builder.modelCard; } /** *

* A model displayed in the Model Dashboard. *

* * @return A model displayed in the Model Dashboard. */ public final Model model() { return model; } /** * For responses, this returns true if the service returned a value for the Endpoints 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 hasEndpoints() { return endpoints != null && !(endpoints instanceof SdkAutoConstructList); } /** *

* The endpoints that host a model. *

*

* 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 #hasEndpoints} method. *

* * @return The endpoints that host a model. */ public final List endpoints() { return endpoints; } /** * Returns the value of the LastBatchTransformJob property for this object. * * @return The value of the LastBatchTransformJob property for this object. */ public final TransformJob lastBatchTransformJob() { return lastBatchTransformJob; } /** * For responses, this returns true if the service returned a value for the MonitoringSchedules 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 hasMonitoringSchedules() { return monitoringSchedules != null && !(monitoringSchedules instanceof SdkAutoConstructList); } /** *

* The monitoring schedules for a model. *

*

* 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 #hasMonitoringSchedules} method. *

* * @return The monitoring schedules for a model. */ public final List monitoringSchedules() { return monitoringSchedules; } /** *

* The model card for a model. *

* * @return The model card for a model. */ public final ModelDashboardModelCard modelCard() { return modelCard; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(model()); hashCode = 31 * hashCode + Objects.hashCode(hasEndpoints() ? endpoints() : null); hashCode = 31 * hashCode + Objects.hashCode(lastBatchTransformJob()); hashCode = 31 * hashCode + Objects.hashCode(hasMonitoringSchedules() ? monitoringSchedules() : null); hashCode = 31 * hashCode + Objects.hashCode(modelCard()); 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 ModelDashboardModel)) { return false; } ModelDashboardModel other = (ModelDashboardModel) obj; return Objects.equals(model(), other.model()) && hasEndpoints() == other.hasEndpoints() && Objects.equals(endpoints(), other.endpoints()) && Objects.equals(lastBatchTransformJob(), other.lastBatchTransformJob()) && hasMonitoringSchedules() == other.hasMonitoringSchedules() && Objects.equals(monitoringSchedules(), other.monitoringSchedules()) && Objects.equals(modelCard(), other.modelCard()); } /** * 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("ModelDashboardModel").add("Model", model()) .add("Endpoints", hasEndpoints() ? endpoints() : null).add("LastBatchTransformJob", lastBatchTransformJob()) .add("MonitoringSchedules", hasMonitoringSchedules() ? monitoringSchedules() : null) .add("ModelCard", modelCard()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Model": return Optional.ofNullable(clazz.cast(model())); case "Endpoints": return Optional.ofNullable(clazz.cast(endpoints())); case "LastBatchTransformJob": return Optional.ofNullable(clazz.cast(lastBatchTransformJob())); case "MonitoringSchedules": return Optional.ofNullable(clazz.cast(monitoringSchedules())); case "ModelCard": return Optional.ofNullable(clazz.cast(modelCard())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ModelDashboardModel) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* A model displayed in the Model Dashboard. *

* * @param model * A model displayed in the Model Dashboard. * @return Returns a reference to this object so that method calls can be chained together. */ Builder model(Model model); /** *

* A model displayed in the Model Dashboard. *

* This is a convenience method that creates an instance of the {@link Model.Builder} avoiding the need to * create one manually via {@link Model#builder()}. * *

* When the {@link Consumer} completes, {@link Model.Builder#build()} is called immediately and its result is * passed to {@link #model(Model)}. * * @param model * a consumer that will call methods on {@link Model.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #model(Model) */ default Builder model(Consumer model) { return model(Model.builder().applyMutation(model).build()); } /** *

* The endpoints that host a model. *

* * @param endpoints * The endpoints that host a model. * @return Returns a reference to this object so that method calls can be chained together. */ Builder endpoints(Collection endpoints); /** *

* The endpoints that host a model. *

* * @param endpoints * The endpoints that host a model. * @return Returns a reference to this object so that method calls can be chained together. */ Builder endpoints(ModelDashboardEndpoint... endpoints); /** *

* The endpoints that host a model. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.sagemaker.model.ModelDashboardEndpoint.Builder} avoiding the need to * create one manually via * {@link software.amazon.awssdk.services.sagemaker.model.ModelDashboardEndpoint#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.sagemaker.model.ModelDashboardEndpoint.Builder#build()} is called * immediately and its result is passed to {@link #endpoints(List)}. * * @param endpoints * a consumer that will call methods on * {@link software.amazon.awssdk.services.sagemaker.model.ModelDashboardEndpoint.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #endpoints(java.util.Collection) */ Builder endpoints(Consumer... endpoints); /** * Sets the value of the LastBatchTransformJob property for this object. * * @param lastBatchTransformJob * The new value for the LastBatchTransformJob property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastBatchTransformJob(TransformJob lastBatchTransformJob); /** * Sets the value of the LastBatchTransformJob property for this object. * * This is a convenience method that creates an instance of the {@link TransformJob.Builder} avoiding the need * to create one manually via {@link TransformJob#builder()}. * *

* When the {@link Consumer} completes, {@link TransformJob.Builder#build()} is called immediately and its * result is passed to {@link #lastBatchTransformJob(TransformJob)}. * * @param lastBatchTransformJob * a consumer that will call methods on {@link TransformJob.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #lastBatchTransformJob(TransformJob) */ default Builder lastBatchTransformJob(Consumer lastBatchTransformJob) { return lastBatchTransformJob(TransformJob.builder().applyMutation(lastBatchTransformJob).build()); } /** *

* The monitoring schedules for a model. *

* * @param monitoringSchedules * The monitoring schedules for a model. * @return Returns a reference to this object so that method calls can be chained together. */ Builder monitoringSchedules(Collection monitoringSchedules); /** *

* The monitoring schedules for a model. *

* * @param monitoringSchedules * The monitoring schedules for a model. * @return Returns a reference to this object so that method calls can be chained together. */ Builder monitoringSchedules(ModelDashboardMonitoringSchedule... monitoringSchedules); /** *

* The monitoring schedules for a model. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.sagemaker.model.ModelDashboardMonitoringSchedule.Builder} avoiding the * need to create one manually via * {@link software.amazon.awssdk.services.sagemaker.model.ModelDashboardMonitoringSchedule#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.sagemaker.model.ModelDashboardMonitoringSchedule.Builder#build()} is * called immediately and its result is passed to {@link * #monitoringSchedules(List)}. * * @param monitoringSchedules * a consumer that will call methods on * {@link software.amazon.awssdk.services.sagemaker.model.ModelDashboardMonitoringSchedule.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #monitoringSchedules(java.util.Collection) */ Builder monitoringSchedules(Consumer... monitoringSchedules); /** *

* The model card for a model. *

* * @param modelCard * The model card for a model. * @return Returns a reference to this object so that method calls can be chained together. */ Builder modelCard(ModelDashboardModelCard modelCard); /** *

* The model card for a model. *

* This is a convenience method that creates an instance of the {@link ModelDashboardModelCard.Builder} avoiding * the need to create one manually via {@link ModelDashboardModelCard#builder()}. * *

* When the {@link Consumer} completes, {@link ModelDashboardModelCard.Builder#build()} is called immediately * and its result is passed to {@link #modelCard(ModelDashboardModelCard)}. * * @param modelCard * a consumer that will call methods on {@link ModelDashboardModelCard.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #modelCard(ModelDashboardModelCard) */ default Builder modelCard(Consumer modelCard) { return modelCard(ModelDashboardModelCard.builder().applyMutation(modelCard).build()); } } static final class BuilderImpl implements Builder { private Model model; private List endpoints = DefaultSdkAutoConstructList.getInstance(); private TransformJob lastBatchTransformJob; private List monitoringSchedules = DefaultSdkAutoConstructList.getInstance(); private ModelDashboardModelCard modelCard; private BuilderImpl() { } private BuilderImpl(ModelDashboardModel model) { model(model.model); endpoints(model.endpoints); lastBatchTransformJob(model.lastBatchTransformJob); monitoringSchedules(model.monitoringSchedules); modelCard(model.modelCard); } public final Model.Builder getModel() { return model != null ? model.toBuilder() : null; } public final void setModel(Model.BuilderImpl model) { this.model = model != null ? model.build() : null; } @Override public final Builder model(Model model) { this.model = model; return this; } public final List getEndpoints() { List result = ModelDashboardEndpointsCopier.copyToBuilder(this.endpoints); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setEndpoints(Collection endpoints) { this.endpoints = ModelDashboardEndpointsCopier.copyFromBuilder(endpoints); } @Override public final Builder endpoints(Collection endpoints) { this.endpoints = ModelDashboardEndpointsCopier.copy(endpoints); return this; } @Override @SafeVarargs public final Builder endpoints(ModelDashboardEndpoint... endpoints) { endpoints(Arrays.asList(endpoints)); return this; } @Override @SafeVarargs public final Builder endpoints(Consumer... endpoints) { endpoints(Stream.of(endpoints).map(c -> ModelDashboardEndpoint.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final TransformJob.Builder getLastBatchTransformJob() { return lastBatchTransformJob != null ? lastBatchTransformJob.toBuilder() : null; } public final void setLastBatchTransformJob(TransformJob.BuilderImpl lastBatchTransformJob) { this.lastBatchTransformJob = lastBatchTransformJob != null ? lastBatchTransformJob.build() : null; } @Override public final Builder lastBatchTransformJob(TransformJob lastBatchTransformJob) { this.lastBatchTransformJob = lastBatchTransformJob; return this; } public final List getMonitoringSchedules() { List result = ModelDashboardMonitoringSchedulesCopier .copyToBuilder(this.monitoringSchedules); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setMonitoringSchedules(Collection monitoringSchedules) { this.monitoringSchedules = ModelDashboardMonitoringSchedulesCopier.copyFromBuilder(monitoringSchedules); } @Override public final Builder monitoringSchedules(Collection monitoringSchedules) { this.monitoringSchedules = ModelDashboardMonitoringSchedulesCopier.copy(monitoringSchedules); return this; } @Override @SafeVarargs public final Builder monitoringSchedules(ModelDashboardMonitoringSchedule... monitoringSchedules) { monitoringSchedules(Arrays.asList(monitoringSchedules)); return this; } @Override @SafeVarargs public final Builder monitoringSchedules(Consumer... monitoringSchedules) { monitoringSchedules(Stream.of(monitoringSchedules) .map(c -> ModelDashboardMonitoringSchedule.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final ModelDashboardModelCard.Builder getModelCard() { return modelCard != null ? modelCard.toBuilder() : null; } public final void setModelCard(ModelDashboardModelCard.BuilderImpl modelCard) { this.modelCard = modelCard != null ? modelCard.build() : null; } @Override public final Builder modelCard(ModelDashboardModelCard modelCard) { this.modelCard = modelCard; return this; } @Override public ModelDashboardModel build() { return new ModelDashboardModel(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy