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

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

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class PutResourceAttributesRequest extends MigrationHubRequest implements
        ToCopyableBuilder {
    private static final SdkField PROGRESS_UPDATE_STREAM_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ProgressUpdateStream").getter(getter(PutResourceAttributesRequest::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(PutResourceAttributesRequest::migrationTaskName))
            .setter(setter(Builder::migrationTaskName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MigrationTaskName").build()).build();

    private static final SdkField> RESOURCE_ATTRIBUTE_LIST_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("ResourceAttributeList")
            .getter(getter(PutResourceAttributesRequest::resourceAttributeList))
            .setter(setter(Builder::resourceAttributeList))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceAttributeList").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(ResourceAttribute::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField DRY_RUN_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
            .memberName("DryRun").getter(getter(PutResourceAttributesRequest::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, RESOURCE_ATTRIBUTE_LIST_FIELD, DRY_RUN_FIELD));

    private final String progressUpdateStream;

    private final String migrationTaskName;

    private final List resourceAttributeList;

    private final Boolean dryRun;

    private PutResourceAttributesRequest(BuilderImpl builder) {
        super(builder);
        this.progressUpdateStream = builder.progressUpdateStream;
        this.migrationTaskName = builder.migrationTaskName;
        this.resourceAttributeList = builder.resourceAttributeList;
        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; } /** * Returns true if the ResourceAttributeList property was specified by the sender (it may be empty), or false if the * sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS * service. */ public final boolean hasResourceAttributeList() { return resourceAttributeList != null && !(resourceAttributeList instanceof SdkAutoConstructList); } /** *

* Information about the resource that is being migrated. This data will be used to map the task to a resource in * the Application Discovery Service repository. *

* *

* Takes the object array of ResourceAttribute where the Type field is reserved for the * following values: * IPV4_ADDRESS | IPV6_ADDRESS | MAC_ADDRESS | FQDN | VM_MANAGER_ID | VM_MANAGED_OBJECT_REFERENCE | VM_NAME | VM_PATH | BIOS_ID | MOTHERBOARD_SERIAL_NUMBER * where the identifying value can be a string up to 256 characters. *

*
*
    *
  • *

    * If any "VM" related value is set for a ResourceAttribute object, it is required that * VM_MANAGER_ID, as a minimum, is always set. If VM_MANAGER_ID is not set, then all "VM" * fields will be discarded and "VM" fields will not be used for matching the migration task to a server in * Application Discovery Service repository. See the Example section below for a use case of specifying "VM" related values. *

    *
  • *
  • *

    * If a server you are trying to match has multiple IP or MAC addresses, you should provide as many as you know in * separate type/value pairs passed to the ResourceAttributeList parameter to maximize the chances of * matching. *

    *
  • *
*
*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasResourceAttributeList()} to see if a value was sent in this field. *

* * @return Information about the resource that is being migrated. This data will be used to map the task to a * resource in the Application Discovery Service repository.

*

* Takes the object array of ResourceAttribute where the Type field is reserved * for the following values: * IPV4_ADDRESS | IPV6_ADDRESS | MAC_ADDRESS | FQDN | VM_MANAGER_ID | VM_MANAGED_OBJECT_REFERENCE | VM_NAME | VM_PATH | BIOS_ID | MOTHERBOARD_SERIAL_NUMBER * where the identifying value can be a string up to 256 characters. *

*
*
    *
  • *

    * If any "VM" related value is set for a ResourceAttribute object, it is required that * VM_MANAGER_ID, as a minimum, is always set. If VM_MANAGER_ID is not set, then * all "VM" fields will be discarded and "VM" fields will not be used for matching the migration task to a * server in Application Discovery Service repository. See the Example section below for a use case of specifying "VM" related values. *

    *
  • *
  • *

    * If a server you are trying to match has multiple IP or MAC addresses, you should provide as many as you * know in separate type/value pairs passed to the ResourceAttributeList parameter to maximize * the chances of matching. *

    *
  • *
*/ public final List resourceAttributeList() { return resourceAttributeList; } /** *

* 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(hasResourceAttributeList() ? resourceAttributeList() : null); 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 PutResourceAttributesRequest)) { return false; } PutResourceAttributesRequest other = (PutResourceAttributesRequest) obj; return Objects.equals(progressUpdateStream(), other.progressUpdateStream()) && Objects.equals(migrationTaskName(), other.migrationTaskName()) && hasResourceAttributeList() == other.hasResourceAttributeList() && Objects.equals(resourceAttributeList(), other.resourceAttributeList()) && 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("PutResourceAttributesRequest").add("ProgressUpdateStream", progressUpdateStream()) .add("MigrationTaskName", migrationTaskName()) .add("ResourceAttributeList", hasResourceAttributeList() ? resourceAttributeList() : null) .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 "ResourceAttributeList": return Optional.ofNullable(clazz.cast(resourceAttributeList())); 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((PutResourceAttributesRequest) 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 resource that is being migrated. This data will be used to map the task to a resource * in the Application Discovery Service repository. *

* *

* Takes the object array of ResourceAttribute where the Type field is reserved for * the following values: * IPV4_ADDRESS | IPV6_ADDRESS | MAC_ADDRESS | FQDN | VM_MANAGER_ID | VM_MANAGED_OBJECT_REFERENCE | VM_NAME | VM_PATH | BIOS_ID | MOTHERBOARD_SERIAL_NUMBER * where the identifying value can be a string up to 256 characters. *

*
*
    *
  • *

    * If any "VM" related value is set for a ResourceAttribute object, it is required that * VM_MANAGER_ID, as a minimum, is always set. If VM_MANAGER_ID is not set, then all * "VM" fields will be discarded and "VM" fields will not be used for matching the migration task to a server in * Application Discovery Service repository. See the Example section below for a use case of specifying "VM" related values. *

    *
  • *
  • *

    * If a server you are trying to match has multiple IP or MAC addresses, you should provide as many as you know * in separate type/value pairs passed to the ResourceAttributeList parameter to maximize the * chances of matching. *

    *
  • *
*
* * @param resourceAttributeList * Information about the resource that is being migrated. This data will be used to map the task to a * resource in the Application Discovery Service repository.

*

* Takes the object array of ResourceAttribute where the Type field is reserved * for the following values: * IPV4_ADDRESS | IPV6_ADDRESS | MAC_ADDRESS | FQDN | VM_MANAGER_ID | VM_MANAGED_OBJECT_REFERENCE | VM_NAME | VM_PATH | BIOS_ID | MOTHERBOARD_SERIAL_NUMBER * where the identifying value can be a string up to 256 characters. *

*
*
    *
  • *

    * If any "VM" related value is set for a ResourceAttribute object, it is required that * VM_MANAGER_ID, as a minimum, is always set. If VM_MANAGER_ID is not set, * then all "VM" fields will be discarded and "VM" fields will not be used for matching the migration * task to a server in Application Discovery Service repository. See the Example section below for a use case of specifying "VM" related values. *

    *
  • *
  • *

    * If a server you are trying to match has multiple IP or MAC addresses, you should provide as many as * you know in separate type/value pairs passed to the ResourceAttributeList parameter to * maximize the chances of matching. *

    *
  • *
* @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceAttributeList(Collection resourceAttributeList); /** *

* Information about the resource that is being migrated. This data will be used to map the task to a resource * in the Application Discovery Service repository. *

* *

* Takes the object array of ResourceAttribute where the Type field is reserved for * the following values: * IPV4_ADDRESS | IPV6_ADDRESS | MAC_ADDRESS | FQDN | VM_MANAGER_ID | VM_MANAGED_OBJECT_REFERENCE | VM_NAME | VM_PATH | BIOS_ID | MOTHERBOARD_SERIAL_NUMBER * where the identifying value can be a string up to 256 characters. *

*
*
    *
  • *

    * If any "VM" related value is set for a ResourceAttribute object, it is required that * VM_MANAGER_ID, as a minimum, is always set. If VM_MANAGER_ID is not set, then all * "VM" fields will be discarded and "VM" fields will not be used for matching the migration task to a server in * Application Discovery Service repository. See the Example section below for a use case of specifying "VM" related values. *

    *
  • *
  • *

    * If a server you are trying to match has multiple IP or MAC addresses, you should provide as many as you know * in separate type/value pairs passed to the ResourceAttributeList parameter to maximize the * chances of matching. *

    *
  • *
*
* * @param resourceAttributeList * Information about the resource that is being migrated. This data will be used to map the task to a * resource in the Application Discovery Service repository.

*

* Takes the object array of ResourceAttribute where the Type field is reserved * for the following values: * IPV4_ADDRESS | IPV6_ADDRESS | MAC_ADDRESS | FQDN | VM_MANAGER_ID | VM_MANAGED_OBJECT_REFERENCE | VM_NAME | VM_PATH | BIOS_ID | MOTHERBOARD_SERIAL_NUMBER * where the identifying value can be a string up to 256 characters. *

*
*
    *
  • *

    * If any "VM" related value is set for a ResourceAttribute object, it is required that * VM_MANAGER_ID, as a minimum, is always set. If VM_MANAGER_ID is not set, * then all "VM" fields will be discarded and "VM" fields will not be used for matching the migration * task to a server in Application Discovery Service repository. See the Example section below for a use case of specifying "VM" related values. *

    *
  • *
  • *

    * If a server you are trying to match has multiple IP or MAC addresses, you should provide as many as * you know in separate type/value pairs passed to the ResourceAttributeList parameter to * maximize the chances of matching. *

    *
  • *
* @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceAttributeList(ResourceAttribute... resourceAttributeList); /** *

* Information about the resource that is being migrated. This data will be used to map the task to a resource * in the Application Discovery Service repository. *

* *

* Takes the object array of ResourceAttribute where the Type field is reserved for * the following values: * IPV4_ADDRESS | IPV6_ADDRESS | MAC_ADDRESS | FQDN | VM_MANAGER_ID | VM_MANAGED_OBJECT_REFERENCE | VM_NAME | VM_PATH | BIOS_ID | MOTHERBOARD_SERIAL_NUMBER * where the identifying value can be a string up to 256 characters. *

*
*
    *
  • *

    * If any "VM" related value is set for a ResourceAttribute object, it is required that * VM_MANAGER_ID, as a minimum, is always set. If VM_MANAGER_ID is not set, then all * "VM" fields will be discarded and "VM" fields will not be used for matching the migration task to a server in * Application Discovery Service repository. See the Example section below for a use case of specifying "VM" related values. *

    *
  • *
  • *

    * If a server you are trying to match has multiple IP or MAC addresses, you should provide as many as you know * in separate type/value pairs passed to the ResourceAttributeList parameter to maximize the * chances of matching. *

    *
  • *
*
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 #resourceAttributeList(List)}. * * @param resourceAttributeList * 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 #resourceAttributeList(List) */ Builder resourceAttributeList(Consumer... resourceAttributeList); /** *

* 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 List resourceAttributeList = DefaultSdkAutoConstructList.getInstance(); private Boolean dryRun; private BuilderImpl() { } private BuilderImpl(PutResourceAttributesRequest model) { super(model); progressUpdateStream(model.progressUpdateStream); migrationTaskName(model.migrationTaskName); resourceAttributeList(model.resourceAttributeList); dryRun(model.dryRun); } public final String getProgressUpdateStream() { return progressUpdateStream; } @Override public final Builder progressUpdateStream(String progressUpdateStream) { this.progressUpdateStream = progressUpdateStream; return this; } public final void setProgressUpdateStream(String progressUpdateStream) { this.progressUpdateStream = progressUpdateStream; } public final String getMigrationTaskName() { return migrationTaskName; } @Override public final Builder migrationTaskName(String migrationTaskName) { this.migrationTaskName = migrationTaskName; return this; } public final void setMigrationTaskName(String migrationTaskName) { this.migrationTaskName = migrationTaskName; } public final Collection getResourceAttributeList() { if (resourceAttributeList instanceof SdkAutoConstructList) { return null; } return resourceAttributeList != null ? resourceAttributeList.stream().map(ResourceAttribute::toBuilder) .collect(Collectors.toList()) : null; } @Override public final Builder resourceAttributeList(Collection resourceAttributeList) { this.resourceAttributeList = ResourceAttributeListCopier.copy(resourceAttributeList); return this; } @Override @SafeVarargs public final Builder resourceAttributeList(ResourceAttribute... resourceAttributeList) { resourceAttributeList(Arrays.asList(resourceAttributeList)); return this; } @Override @SafeVarargs public final Builder resourceAttributeList(Consumer... resourceAttributeList) { resourceAttributeList(Stream.of(resourceAttributeList).map(c -> ResourceAttribute.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setResourceAttributeList(Collection resourceAttributeList) { this.resourceAttributeList = ResourceAttributeListCopier.copyFromBuilder(resourceAttributeList); } public final Boolean getDryRun() { return dryRun; } @Override public final Builder dryRun(Boolean dryRun) { this.dryRun = dryRun; return this; } public final void setDryRun(Boolean dryRun) { this.dryRun = dryRun; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public PutResourceAttributesRequest build() { return new PutResourceAttributesRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy