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

software.amazon.awssdk.services.migrationhub.model.NotifyMigrationTaskStateRequest 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.migrationhub.model;

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.Consumer;
import java.util.function.Function;
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.LocationTrait;
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 NotifyMigrationTaskStateRequest extends MigrationHubRequest implements
        ToCopyableBuilder {
    private static final SdkField PROGRESS_UPDATE_STREAM_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ProgressUpdateStream").getter(getter(NotifyMigrationTaskStateRequest::progressUpdateStream))
            .setter(setter(Builder::progressUpdateStream))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProgressUpdateStream").build())
            .build();

    private static final SdkField MIGRATION_TASK_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("MigrationTaskName").getter(getter(NotifyMigrationTaskStateRequest::migrationTaskName))
            .setter(setter(Builder::migrationTaskName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MigrationTaskName").build()).build();

    private static final SdkField TASK_FIELD = SdkField. builder(MarshallingType.SDK_POJO).memberName("Task")
            .getter(getter(NotifyMigrationTaskStateRequest::task)).setter(setter(Builder::task)).constructor(Task::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Task").build()).build();

    private static final SdkField UPDATE_DATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .memberName("UpdateDateTime").getter(getter(NotifyMigrationTaskStateRequest::updateDateTime))
            .setter(setter(Builder::updateDateTime))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdateDateTime").build()).build();

    private static final SdkField NEXT_UPDATE_SECONDS_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .memberName("NextUpdateSeconds").getter(getter(NotifyMigrationTaskStateRequest::nextUpdateSeconds))
            .setter(setter(Builder::nextUpdateSeconds))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NextUpdateSeconds").build()).build();

    private static final SdkField DRY_RUN_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
            .memberName("DryRun").getter(getter(NotifyMigrationTaskStateRequest::dryRun)).setter(setter(Builder::dryRun))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DryRun").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PROGRESS_UPDATE_STREAM_FIELD,
            MIGRATION_TASK_NAME_FIELD, TASK_FIELD, UPDATE_DATE_TIME_FIELD, NEXT_UPDATE_SECONDS_FIELD, DRY_RUN_FIELD));

    private final String progressUpdateStream;

    private final String migrationTaskName;

    private final Task task;

    private final Instant updateDateTime;

    private final Integer nextUpdateSeconds;

    private final Boolean dryRun;

    private NotifyMigrationTaskStateRequest(BuilderImpl builder) {
        super(builder);
        this.progressUpdateStream = builder.progressUpdateStream;
        this.migrationTaskName = builder.migrationTaskName;
        this.task = builder.task;
        this.updateDateTime = builder.updateDateTime;
        this.nextUpdateSeconds = builder.nextUpdateSeconds;
        this.dryRun = builder.dryRun;
    }

    /**
     * 

* The name of the ProgressUpdateStream. *

* * @return The name of the ProgressUpdateStream. */ public final String progressUpdateStream() { return progressUpdateStream; } /** *

* Unique identifier that references the migration task. Do not store personal data in this field. *

* * @return Unique identifier that references the migration task. Do not store personal data in this field. */ public final String migrationTaskName() { return migrationTaskName; } /** *

* Information about the task's progress and status. *

* * @return Information about the task's progress and status. */ public final Task task() { return task; } /** *

* The timestamp when the task was gathered. *

* * @return The timestamp when the task was gathered. */ public final Instant updateDateTime() { return updateDateTime; } /** *

* Number of seconds after the UpdateDateTime within which the Migration Hub can expect an update. If Migration Hub * does not receive an update within the specified interval, then the migration task will be considered stale. *

* * @return Number of seconds after the UpdateDateTime within which the Migration Hub can expect an update. If * Migration Hub does not receive an update within the specified interval, then the migration task will be * considered stale. */ public final Integer nextUpdateSeconds() { return nextUpdateSeconds; } /** *

* Optional boolean flag to indicate whether any effect should take place. Used to test if the caller has permission * to make the call. *

* * @return Optional boolean flag to indicate whether any effect should take place. Used to test if the caller has * permission to make the call. */ public final Boolean dryRun() { return dryRun; } @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(progressUpdateStream()); hashCode = 31 * hashCode + Objects.hashCode(migrationTaskName()); hashCode = 31 * hashCode + Objects.hashCode(task()); hashCode = 31 * hashCode + Objects.hashCode(updateDateTime()); hashCode = 31 * hashCode + Objects.hashCode(nextUpdateSeconds()); hashCode = 31 * hashCode + Objects.hashCode(dryRun()); 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 NotifyMigrationTaskStateRequest)) { return false; } NotifyMigrationTaskStateRequest other = (NotifyMigrationTaskStateRequest) obj; return Objects.equals(progressUpdateStream(), other.progressUpdateStream()) && Objects.equals(migrationTaskName(), other.migrationTaskName()) && Objects.equals(task(), other.task()) && Objects.equals(updateDateTime(), other.updateDateTime()) && Objects.equals(nextUpdateSeconds(), other.nextUpdateSeconds()) && Objects.equals(dryRun(), other.dryRun()); } /** * 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("NotifyMigrationTaskStateRequest").add("ProgressUpdateStream", progressUpdateStream()) .add("MigrationTaskName", migrationTaskName()).add("Task", task()).add("UpdateDateTime", updateDateTime()) .add("NextUpdateSeconds", nextUpdateSeconds()).add("DryRun", dryRun()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ProgressUpdateStream": return Optional.ofNullable(clazz.cast(progressUpdateStream())); case "MigrationTaskName": return Optional.ofNullable(clazz.cast(migrationTaskName())); case "Task": return Optional.ofNullable(clazz.cast(task())); case "UpdateDateTime": return Optional.ofNullable(clazz.cast(updateDateTime())); case "NextUpdateSeconds": return Optional.ofNullable(clazz.cast(nextUpdateSeconds())); case "DryRun": return Optional.ofNullable(clazz.cast(dryRun())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((NotifyMigrationTaskStateRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends MigrationHubRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The name of the ProgressUpdateStream. *

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

* Unique identifier that references the migration task. Do not store personal data in this field. *

* * @param migrationTaskName * Unique identifier that references the migration task. Do not store personal data in this field. * @return Returns a reference to this object so that method calls can be chained together. */ Builder migrationTaskName(String migrationTaskName); /** *

* Information about the task's progress and status. *

* * @param task * Information about the task's progress and status. * @return Returns a reference to this object so that method calls can be chained together. */ Builder task(Task task); /** *

* Information about the task's progress and status. *

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

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

* The timestamp when the task was gathered. *

* * @param updateDateTime * The timestamp when the task was gathered. * @return Returns a reference to this object so that method calls can be chained together. */ Builder updateDateTime(Instant updateDateTime); /** *

* Number of seconds after the UpdateDateTime within which the Migration Hub can expect an update. If Migration * Hub does not receive an update within the specified interval, then the migration task will be considered * stale. *

* * @param nextUpdateSeconds * Number of seconds after the UpdateDateTime within which the Migration Hub can expect an update. If * Migration Hub does not receive an update within the specified interval, then the migration task will * be considered stale. * @return Returns a reference to this object so that method calls can be chained together. */ Builder nextUpdateSeconds(Integer nextUpdateSeconds); /** *

* Optional boolean flag to indicate whether any effect should take place. Used to test if the caller has * permission to make the call. *

* * @param dryRun * Optional boolean flag to indicate whether any effect should take place. Used to test if the caller has * permission to make the call. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dryRun(Boolean dryRun); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends MigrationHubRequest.BuilderImpl implements Builder { private String progressUpdateStream; private String migrationTaskName; private Task task; private Instant updateDateTime; private Integer nextUpdateSeconds; private Boolean dryRun; private BuilderImpl() { } private BuilderImpl(NotifyMigrationTaskStateRequest model) { super(model); progressUpdateStream(model.progressUpdateStream); migrationTaskName(model.migrationTaskName); task(model.task); updateDateTime(model.updateDateTime); nextUpdateSeconds(model.nextUpdateSeconds); dryRun(model.dryRun); } public final String getProgressUpdateStream() { return progressUpdateStream; } public final void setProgressUpdateStream(String progressUpdateStream) { this.progressUpdateStream = progressUpdateStream; } @Override public final Builder progressUpdateStream(String progressUpdateStream) { this.progressUpdateStream = progressUpdateStream; return this; } public final String getMigrationTaskName() { return migrationTaskName; } public final void setMigrationTaskName(String migrationTaskName) { this.migrationTaskName = migrationTaskName; } @Override public final Builder migrationTaskName(String migrationTaskName) { this.migrationTaskName = migrationTaskName; return this; } public final Task.Builder getTask() { return task != null ? task.toBuilder() : null; } public final void setTask(Task.BuilderImpl task) { this.task = task != null ? task.build() : null; } @Override public final Builder task(Task task) { this.task = task; return this; } public final Instant getUpdateDateTime() { return updateDateTime; } public final void setUpdateDateTime(Instant updateDateTime) { this.updateDateTime = updateDateTime; } @Override public final Builder updateDateTime(Instant updateDateTime) { this.updateDateTime = updateDateTime; return this; } public final Integer getNextUpdateSeconds() { return nextUpdateSeconds; } public final void setNextUpdateSeconds(Integer nextUpdateSeconds) { this.nextUpdateSeconds = nextUpdateSeconds; } @Override public final Builder nextUpdateSeconds(Integer nextUpdateSeconds) { this.nextUpdateSeconds = nextUpdateSeconds; return this; } public final Boolean getDryRun() { return dryRun; } public final void setDryRun(Boolean dryRun) { this.dryRun = dryRun; } @Override public final Builder dryRun(Boolean dryRun) { this.dryRun = dryRun; 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 NotifyMigrationTaskStateRequest build() { return new NotifyMigrationTaskStateRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy