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

software.amazon.awssdk.services.sagemaker.model.CreateActionRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon SageMaker module holds the client classes that are used for communicating with Amazon SageMaker Service

There is a newer version: 2.30.1
Show newest version
/*
 * 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.beans.Transient;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
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.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.awscore.AwsRequestOverrideConfiguration;
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.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class CreateActionRequest extends SageMakerRequest implements
        ToCopyableBuilder {
    private static final SdkField ACTION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ActionName").getter(getter(CreateActionRequest::actionName)).setter(setter(Builder::actionName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActionName").build()).build();

    private static final SdkField SOURCE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .memberName("Source").getter(getter(CreateActionRequest::source)).setter(setter(Builder::source))
            .constructor(ActionSource::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Source").build()).build();

    private static final SdkField ACTION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ActionType").getter(getter(CreateActionRequest::actionType)).setter(setter(Builder::actionType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActionType").build()).build();

    private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("Description").getter(getter(CreateActionRequest::description)).setter(setter(Builder::description))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();

    private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
            .getter(getter(CreateActionRequest::statusAsString)).setter(setter(Builder::status))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();

    private static final SdkField> PROPERTIES_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("Properties")
            .getter(getter(CreateActionRequest::properties))
            .setter(setter(Builder::properties))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Properties").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final SdkField METADATA_PROPERTIES_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("MetadataProperties")
            .getter(getter(CreateActionRequest::metadataProperties)).setter(setter(Builder::metadataProperties))
            .constructor(MetadataProperties::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MetadataProperties").build())
            .build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("Tags")
            .getter(getter(CreateActionRequest::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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACTION_NAME_FIELD,
            SOURCE_FIELD, ACTION_TYPE_FIELD, DESCRIPTION_FIELD, STATUS_FIELD, PROPERTIES_FIELD, METADATA_PROPERTIES_FIELD,
            TAGS_FIELD));

    private final String actionName;

    private final ActionSource source;

    private final String actionType;

    private final String description;

    private final String status;

    private final Map properties;

    private final MetadataProperties metadataProperties;

    private final List tags;

    private CreateActionRequest(BuilderImpl builder) {
        super(builder);
        this.actionName = builder.actionName;
        this.source = builder.source;
        this.actionType = builder.actionType;
        this.description = builder.description;
        this.status = builder.status;
        this.properties = builder.properties;
        this.metadataProperties = builder.metadataProperties;
        this.tags = builder.tags;
    }

    /**
     * 

* The name of the action. Must be unique to your account in an Amazon Web Services Region. *

* * @return The name of the action. Must be unique to your account in an Amazon Web Services Region. */ public final String actionName() { return actionName; } /** *

* The source type, ID, and URI. *

* * @return The source type, ID, and URI. */ public final ActionSource source() { return source; } /** *

* The action type. *

* * @return The action type. */ public final String actionType() { return actionType; } /** *

* The description of the action. *

* * @return The description of the action. */ public final String description() { return description; } /** *

* The status of the action. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link ActionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statusAsString}. *

* * @return The status of the action. * @see ActionStatus */ public final ActionStatus status() { return ActionStatus.fromValue(status); } /** *

* The status of the action. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link ActionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statusAsString}. *

* * @return The status of the action. * @see ActionStatus */ public final String statusAsString() { return status; } /** * For responses, this returns true if the service returned a value for the Properties 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 hasProperties() { return properties != null && !(properties instanceof SdkAutoConstructMap); } /** *

* A list of properties to add to the action. *

*

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

* * @return A list of properties to add to the action. */ public final Map properties() { return properties; } /** * Returns the value of the MetadataProperties property for this object. * * @return The value of the MetadataProperties property for this object. */ public final MetadataProperties metadataProperties() { return metadataProperties; } /** * 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); } /** *

* A list of tags to apply to the action. *

*

* 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 A list of tags to apply to the action. */ public final List tags() { return tags; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(actionName()); hashCode = 31 * hashCode + Objects.hashCode(source()); hashCode = 31 * hashCode + Objects.hashCode(actionType()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasProperties() ? properties() : null); hashCode = 31 * hashCode + Objects.hashCode(metadataProperties()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CreateActionRequest)) { return false; } CreateActionRequest other = (CreateActionRequest) obj; return Objects.equals(actionName(), other.actionName()) && Objects.equals(source(), other.source()) && Objects.equals(actionType(), other.actionType()) && Objects.equals(description(), other.description()) && Objects.equals(statusAsString(), other.statusAsString()) && hasProperties() == other.hasProperties() && Objects.equals(properties(), other.properties()) && Objects.equals(metadataProperties(), other.metadataProperties()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()); } /** * 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("CreateActionRequest").add("ActionName", actionName()).add("Source", source()) .add("ActionType", actionType()).add("Description", description()).add("Status", statusAsString()) .add("Properties", hasProperties() ? properties() : null).add("MetadataProperties", metadataProperties()) .add("Tags", hasTags() ? tags() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ActionName": return Optional.ofNullable(clazz.cast(actionName())); case "Source": return Optional.ofNullable(clazz.cast(source())); case "ActionType": return Optional.ofNullable(clazz.cast(actionType())); case "Description": return Optional.ofNullable(clazz.cast(description())); case "Status": return Optional.ofNullable(clazz.cast(statusAsString())); case "Properties": return Optional.ofNullable(clazz.cast(properties())); case "MetadataProperties": return Optional.ofNullable(clazz.cast(metadataProperties())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CreateActionRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SageMakerRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The name of the action. Must be unique to your account in an Amazon Web Services Region. *

* * @param actionName * The name of the action. Must be unique to your account in an Amazon Web Services Region. * @return Returns a reference to this object so that method calls can be chained together. */ Builder actionName(String actionName); /** *

* The source type, ID, and URI. *

* * @param source * The source type, ID, and URI. * @return Returns a reference to this object so that method calls can be chained together. */ Builder source(ActionSource source); /** *

* The source type, ID, and URI. *

* This is a convenience that creates an instance of the {@link ActionSource.Builder} avoiding the need to * create one manually via {@link ActionSource#builder()}. * * When the {@link Consumer} completes, {@link ActionSource.Builder#build()} is called immediately and its * result is passed to {@link #source(ActionSource)}. * * @param source * a consumer that will call methods on {@link ActionSource.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #source(ActionSource) */ default Builder source(Consumer source) { return source(ActionSource.builder().applyMutation(source).build()); } /** *

* The action type. *

* * @param actionType * The action type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder actionType(String actionType); /** *

* The description of the action. *

* * @param description * The description of the action. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* The status of the action. *

* * @param status * The status of the action. * @see ActionStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ActionStatus */ Builder status(String status); /** *

* The status of the action. *

* * @param status * The status of the action. * @see ActionStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ActionStatus */ Builder status(ActionStatus status); /** *

* A list of properties to add to the action. *

* * @param properties * A list of properties to add to the action. * @return Returns a reference to this object so that method calls can be chained together. */ Builder properties(Map properties); /** * Sets the value of the MetadataProperties property for this object. * * @param metadataProperties * The new value for the MetadataProperties property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metadataProperties(MetadataProperties metadataProperties); /** * Sets the value of the MetadataProperties property for this object. * * This is a convenience that creates an instance of the {@link MetadataProperties.Builder} avoiding the need to * create one manually via {@link MetadataProperties#builder()}. * * When the {@link Consumer} completes, {@link MetadataProperties.Builder#build()} is called immediately and its * result is passed to {@link #metadataProperties(MetadataProperties)}. * * @param metadataProperties * a consumer that will call methods on {@link MetadataProperties.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #metadataProperties(MetadataProperties) */ default Builder metadataProperties(Consumer metadataProperties) { return metadataProperties(MetadataProperties.builder().applyMutation(metadataProperties).build()); } /** *

* A list of tags to apply to the action. *

* * @param tags * A list of tags to apply to the action. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Collection tags); /** *

* A list of tags to apply to the action. *

* * @param tags * A list of tags to apply to the action. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Tag... tags); /** *

* A list of tags to apply to the action. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to create * one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result * is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(List) */ Builder tags(Consumer... tags); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends SageMakerRequest.BuilderImpl implements Builder { private String actionName; private ActionSource source; private String actionType; private String description; private String status; private Map properties = DefaultSdkAutoConstructMap.getInstance(); private MetadataProperties metadataProperties; private List tags = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(CreateActionRequest model) { super(model); actionName(model.actionName); source(model.source); actionType(model.actionType); description(model.description); status(model.status); properties(model.properties); metadataProperties(model.metadataProperties); tags(model.tags); } public final String getActionName() { return actionName; } public final void setActionName(String actionName) { this.actionName = actionName; } @Override @Transient public final Builder actionName(String actionName) { this.actionName = actionName; return this; } public final ActionSource.Builder getSource() { return source != null ? source.toBuilder() : null; } public final void setSource(ActionSource.BuilderImpl source) { this.source = source != null ? source.build() : null; } @Override @Transient public final Builder source(ActionSource source) { this.source = source; return this; } public final String getActionType() { return actionType; } public final void setActionType(String actionType) { this.actionType = actionType; } @Override @Transient public final Builder actionType(String actionType) { this.actionType = actionType; return this; } public final String getDescription() { return description; } public final void setDescription(String description) { this.description = description; } @Override @Transient public final Builder description(String description) { this.description = description; return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override @Transient public final Builder status(String status) { this.status = status; return this; } @Override @Transient public final Builder status(ActionStatus status) { this.status(status == null ? null : status.toString()); return this; } public final Map getProperties() { if (properties instanceof SdkAutoConstructMap) { return null; } return properties; } public final void setProperties(Map properties) { this.properties = LineageEntityParametersCopier.copy(properties); } @Override @Transient public final Builder properties(Map properties) { this.properties = LineageEntityParametersCopier.copy(properties); return this; } public final MetadataProperties.Builder getMetadataProperties() { return metadataProperties != null ? metadataProperties.toBuilder() : null; } public final void setMetadataProperties(MetadataProperties.BuilderImpl metadataProperties) { this.metadataProperties = metadataProperties != null ? metadataProperties.build() : null; } @Override @Transient public final Builder metadataProperties(MetadataProperties metadataProperties) { this.metadataProperties = metadataProperties; return this; } public final List getTags() { List result = TagListCopier.copyToBuilder(this.tags); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTags(Collection tags) { this.tags = TagListCopier.copyFromBuilder(tags); } @Override @Transient public final Builder tags(Collection tags) { this.tags = TagListCopier.copy(tags); return this; } @Override @Transient @SafeVarargs public final Builder tags(Tag... tags) { tags(Arrays.asList(tags)); return this; } @Override @Transient @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public CreateActionRequest build() { return new CreateActionRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy