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

software.amazon.awssdk.services.devicefarm.model.UpdateInstanceProfileRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Device Farm module holds the client classes that are used for communicating with AWS Device Farm

There is a newer version: 2.29.39
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.devicefarm.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 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 UpdateInstanceProfileRequest extends DeviceFarmRequest implements
        ToCopyableBuilder {
    private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
            .getter(getter(UpdateInstanceProfileRequest::arn)).setter(setter(Builder::arn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();

    private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
            .getter(getter(UpdateInstanceProfileRequest::name)).setter(setter(Builder::name))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();

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

    private static final SdkField PACKAGE_CLEANUP_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
            .memberName("packageCleanup").getter(getter(UpdateInstanceProfileRequest::packageCleanup))
            .setter(setter(Builder::packageCleanup))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("packageCleanup").build()).build();

    private static final SdkField> EXCLUDE_APP_PACKAGES_FROM_CLEANUP_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("excludeAppPackagesFromCleanup")
            .getter(getter(UpdateInstanceProfileRequest::excludeAppPackagesFromCleanup))
            .setter(setter(Builder::excludeAppPackagesFromCleanup))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("excludeAppPackagesFromCleanup")
                    .build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField REBOOT_AFTER_USE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
            .memberName("rebootAfterUse").getter(getter(UpdateInstanceProfileRequest::rebootAfterUse))
            .setter(setter(Builder::rebootAfterUse))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("rebootAfterUse").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, NAME_FIELD,
            DESCRIPTION_FIELD, PACKAGE_CLEANUP_FIELD, EXCLUDE_APP_PACKAGES_FROM_CLEANUP_FIELD, REBOOT_AFTER_USE_FIELD));

    private final String arn;

    private final String name;

    private final String description;

    private final Boolean packageCleanup;

    private final List excludeAppPackagesFromCleanup;

    private final Boolean rebootAfterUse;

    private UpdateInstanceProfileRequest(BuilderImpl builder) {
        super(builder);
        this.arn = builder.arn;
        this.name = builder.name;
        this.description = builder.description;
        this.packageCleanup = builder.packageCleanup;
        this.excludeAppPackagesFromCleanup = builder.excludeAppPackagesFromCleanup;
        this.rebootAfterUse = builder.rebootAfterUse;
    }

    /**
     * 

* The Amazon Resource Name (ARN) of the instance profile. *

* * @return The Amazon Resource Name (ARN) of the instance profile. */ public String arn() { return arn; } /** *

* The updated name for your instance profile. *

* * @return The updated name for your instance profile. */ public String name() { return name; } /** *

* The updated description for your instance profile. *

* * @return The updated description for your instance profile. */ public String description() { return description; } /** *

* The updated choice for whether you want to specify package cleanup. The default value is false for * private devices. *

* * @return The updated choice for whether you want to specify package cleanup. The default value is * false for private devices. */ public Boolean packageCleanup() { return packageCleanup; } /** * Returns true if the ExcludeAppPackagesFromCleanup 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 boolean hasExcludeAppPackagesFromCleanup() { return excludeAppPackagesFromCleanup != null && !(excludeAppPackagesFromCleanup instanceof SdkAutoConstructList); } /** *

* An array of strings that specifies the list of app packages that should not be cleaned up from the device after a * test run is over. *

*

* The list of packages is only considered if you set packageCleanup to true. *

*

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

*

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

* * @return An array of strings that specifies the list of app packages that should not be cleaned up from the device * after a test run is over.

*

* The list of packages is only considered if you set packageCleanup to true. */ public List excludeAppPackagesFromCleanup() { return excludeAppPackagesFromCleanup; } /** *

* The updated choice for whether you want to reboot the device after use. The default value is true. *

* * @return The updated choice for whether you want to reboot the device after use. The default value is * true. */ public Boolean rebootAfterUse() { return rebootAfterUse; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(arn()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(packageCleanup()); hashCode = 31 * hashCode + Objects.hashCode(hasExcludeAppPackagesFromCleanup() ? excludeAppPackagesFromCleanup() : null); hashCode = 31 * hashCode + Objects.hashCode(rebootAfterUse()); return hashCode; } @Override public boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof UpdateInstanceProfileRequest)) { return false; } UpdateInstanceProfileRequest other = (UpdateInstanceProfileRequest) obj; return Objects.equals(arn(), other.arn()) && Objects.equals(name(), other.name()) && Objects.equals(description(), other.description()) && Objects.equals(packageCleanup(), other.packageCleanup()) && hasExcludeAppPackagesFromCleanup() == other.hasExcludeAppPackagesFromCleanup() && Objects.equals(excludeAppPackagesFromCleanup(), other.excludeAppPackagesFromCleanup()) && Objects.equals(rebootAfterUse(), other.rebootAfterUse()); } /** * 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 String toString() { return ToString .builder("UpdateInstanceProfileRequest") .add("Arn", arn()) .add("Name", name()) .add("Description", description()) .add("PackageCleanup", packageCleanup()) .add("ExcludeAppPackagesFromCleanup", hasExcludeAppPackagesFromCleanup() ? excludeAppPackagesFromCleanup() : null) .add("RebootAfterUse", rebootAfterUse()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "arn": return Optional.ofNullable(clazz.cast(arn())); case "name": return Optional.ofNullable(clazz.cast(name())); case "description": return Optional.ofNullable(clazz.cast(description())); case "packageCleanup": return Optional.ofNullable(clazz.cast(packageCleanup())); case "excludeAppPackagesFromCleanup": return Optional.ofNullable(clazz.cast(excludeAppPackagesFromCleanup())); case "rebootAfterUse": return Optional.ofNullable(clazz.cast(rebootAfterUse())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((UpdateInstanceProfileRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends DeviceFarmRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) of the instance profile. *

* * @param arn * The Amazon Resource Name (ARN) of the instance profile. * @return Returns a reference to this object so that method calls can be chained together. */ Builder arn(String arn); /** *

* The updated name for your instance profile. *

* * @param name * The updated name for your instance profile. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* The updated description for your instance profile. *

* * @param description * The updated description for your instance profile. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* The updated choice for whether you want to specify package cleanup. The default value is false * for private devices. *

* * @param packageCleanup * The updated choice for whether you want to specify package cleanup. The default value is * false for private devices. * @return Returns a reference to this object so that method calls can be chained together. */ Builder packageCleanup(Boolean packageCleanup); /** *

* An array of strings that specifies the list of app packages that should not be cleaned up from the device * after a test run is over. *

*

* The list of packages is only considered if you set packageCleanup to true. *

* * @param excludeAppPackagesFromCleanup * An array of strings that specifies the list of app packages that should not be cleaned up from the * device after a test run is over.

*

* The list of packages is only considered if you set packageCleanup to true. * @return Returns a reference to this object so that method calls can be chained together. */ Builder excludeAppPackagesFromCleanup(Collection excludeAppPackagesFromCleanup); /** *

* An array of strings that specifies the list of app packages that should not be cleaned up from the device * after a test run is over. *

*

* The list of packages is only considered if you set packageCleanup to true. *

* * @param excludeAppPackagesFromCleanup * An array of strings that specifies the list of app packages that should not be cleaned up from the * device after a test run is over.

*

* The list of packages is only considered if you set packageCleanup to true. * @return Returns a reference to this object so that method calls can be chained together. */ Builder excludeAppPackagesFromCleanup(String... excludeAppPackagesFromCleanup); /** *

* The updated choice for whether you want to reboot the device after use. The default value is * true. *

* * @param rebootAfterUse * The updated choice for whether you want to reboot the device after use. The default value is * true. * @return Returns a reference to this object so that method calls can be chained together. */ Builder rebootAfterUse(Boolean rebootAfterUse); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends DeviceFarmRequest.BuilderImpl implements Builder { private String arn; private String name; private String description; private Boolean packageCleanup; private List excludeAppPackagesFromCleanup = DefaultSdkAutoConstructList.getInstance(); private Boolean rebootAfterUse; private BuilderImpl() { } private BuilderImpl(UpdateInstanceProfileRequest model) { super(model); arn(model.arn); name(model.name); description(model.description); packageCleanup(model.packageCleanup); excludeAppPackagesFromCleanup(model.excludeAppPackagesFromCleanup); rebootAfterUse(model.rebootAfterUse); } public final String getArn() { return arn; } @Override public final Builder arn(String arn) { this.arn = arn; return this; } public final void setArn(String arn) { this.arn = arn; } public final String getName() { return name; } @Override public final Builder name(String name) { this.name = name; return this; } public final void setName(String name) { this.name = name; } public final String getDescription() { return description; } @Override public final Builder description(String description) { this.description = description; return this; } public final void setDescription(String description) { this.description = description; } public final Boolean getPackageCleanup() { return packageCleanup; } @Override public final Builder packageCleanup(Boolean packageCleanup) { this.packageCleanup = packageCleanup; return this; } public final void setPackageCleanup(Boolean packageCleanup) { this.packageCleanup = packageCleanup; } public final Collection getExcludeAppPackagesFromCleanup() { if (excludeAppPackagesFromCleanup instanceof SdkAutoConstructList) { return null; } return excludeAppPackagesFromCleanup; } @Override public final Builder excludeAppPackagesFromCleanup(Collection excludeAppPackagesFromCleanup) { this.excludeAppPackagesFromCleanup = PackageIdsCopier.copy(excludeAppPackagesFromCleanup); return this; } @Override @SafeVarargs public final Builder excludeAppPackagesFromCleanup(String... excludeAppPackagesFromCleanup) { excludeAppPackagesFromCleanup(Arrays.asList(excludeAppPackagesFromCleanup)); return this; } public final void setExcludeAppPackagesFromCleanup(Collection excludeAppPackagesFromCleanup) { this.excludeAppPackagesFromCleanup = PackageIdsCopier.copy(excludeAppPackagesFromCleanup); } public final Boolean getRebootAfterUse() { return rebootAfterUse; } @Override public final Builder rebootAfterUse(Boolean rebootAfterUse) { this.rebootAfterUse = rebootAfterUse; return this; } public final void setRebootAfterUse(Boolean rebootAfterUse) { this.rebootAfterUse = rebootAfterUse; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public UpdateInstanceProfileRequest build() { return new UpdateInstanceProfileRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy