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

software.amazon.awssdk.services.devicefarm.model.InstanceProfile 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.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.Function;
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;

/**
 * 

* Represents the instance profile. *

*/ @Generated("software.amazon.awssdk:codegen") public final class InstanceProfile implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn") .getter(getter(InstanceProfile::arn)).setter(setter(Builder::arn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build(); private static final SdkField PACKAGE_CLEANUP_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("packageCleanup").getter(getter(InstanceProfile::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(InstanceProfile::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(InstanceProfile::rebootAfterUse)).setter(setter(Builder::rebootAfterUse)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("rebootAfterUse").build()).build(); private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name") .getter(getter(InstanceProfile::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(InstanceProfile::description)).setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays .asList(ARN_FIELD, PACKAGE_CLEANUP_FIELD, EXCLUDE_APP_PACKAGES_FROM_CLEANUP_FIELD, REBOOT_AFTER_USE_FIELD, NAME_FIELD, DESCRIPTION_FIELD)); private static final long serialVersionUID = 1L; private final String arn; private final Boolean packageCleanup; private final List excludeAppPackagesFromCleanup; private final Boolean rebootAfterUse; private final String name; private final String description; private InstanceProfile(BuilderImpl builder) { this.arn = builder.arn; this.packageCleanup = builder.packageCleanup; this.excludeAppPackagesFromCleanup = builder.excludeAppPackagesFromCleanup; this.rebootAfterUse = builder.rebootAfterUse; this.name = builder.name; this.description = builder.description; } /** *

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

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

* When set to true, Device Farm removes app packages after a test run. The default value is * false for private devices. *

* * @return When set to true, Device Farm removes app packages after a test run. 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 containing the list of app packages that should not be cleaned up from the device after a * test run completes. *

*

* The list of packages is considered only 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 containing the list of app packages that should not be cleaned up from the device * after a test run completes.

*

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

* When set to true, Device Farm reboots the instance after a test run. The default value is * true. *

* * @return When set to true, Device Farm reboots the instance after a test run. The default value is * true. */ public Boolean rebootAfterUse() { return rebootAfterUse; } /** *

* The name of the instance profile. *

* * @return The name of the instance profile. */ public String name() { return name; } /** *

* The description of the instance profile. *

* * @return The description of the instance profile. */ public String description() { return description; } @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 + Objects.hashCode(arn()); hashCode = 31 * hashCode + Objects.hashCode(packageCleanup()); hashCode = 31 * hashCode + Objects.hashCode(hasExcludeAppPackagesFromCleanup() ? excludeAppPackagesFromCleanup() : null); hashCode = 31 * hashCode + Objects.hashCode(rebootAfterUse()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(description()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof InstanceProfile)) { return false; } InstanceProfile other = (InstanceProfile) obj; return Objects.equals(arn(), other.arn()) && Objects.equals(packageCleanup(), other.packageCleanup()) && hasExcludeAppPackagesFromCleanup() == other.hasExcludeAppPackagesFromCleanup() && Objects.equals(excludeAppPackagesFromCleanup(), other.excludeAppPackagesFromCleanup()) && Objects.equals(rebootAfterUse(), other.rebootAfterUse()) && Objects.equals(name(), other.name()) && Objects.equals(description(), other.description()); } /** * 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("InstanceProfile") .add("Arn", arn()) .add("PackageCleanup", packageCleanup()) .add("ExcludeAppPackagesFromCleanup", hasExcludeAppPackagesFromCleanup() ? excludeAppPackagesFromCleanup() : null) .add("RebootAfterUse", rebootAfterUse()).add("Name", name()).add("Description", description()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "arn": return Optional.ofNullable(clazz.cast(arn())); case "packageCleanup": return Optional.ofNullable(clazz.cast(packageCleanup())); case "excludeAppPackagesFromCleanup": return Optional.ofNullable(clazz.cast(excludeAppPackagesFromCleanup())); case "rebootAfterUse": return Optional.ofNullable(clazz.cast(rebootAfterUse())); case "name": return Optional.ofNullable(clazz.cast(name())); case "description": return Optional.ofNullable(clazz.cast(description())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((InstanceProfile) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends 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); /** *

* When set to true, Device Farm removes app packages after a test run. The default value is * false for private devices. *

* * @param packageCleanup * When set to true, Device Farm removes app packages after a test run. 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 containing the list of app packages that should not be cleaned up from the device after a * test run completes. *

*

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

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

*

* The list of packages is considered only 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 containing the list of app packages that should not be cleaned up from the device after a * test run completes. *

*

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

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

*

* The list of packages is considered only 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); /** *

* When set to true, Device Farm reboots the instance after a test run. The default value is * true. *

* * @param rebootAfterUse * When set to true, Device Farm reboots the instance after a test run. The default value is * true. * @return Returns a reference to this object so that method calls can be chained together. */ Builder rebootAfterUse(Boolean rebootAfterUse); /** *

* The name of the instance profile. *

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

* The description of the instance profile. *

* * @param description * The description of the instance profile. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); } static final class BuilderImpl implements Builder { private String arn; private Boolean packageCleanup; private List excludeAppPackagesFromCleanup = DefaultSdkAutoConstructList.getInstance(); private Boolean rebootAfterUse; private String name; private String description; private BuilderImpl() { } private BuilderImpl(InstanceProfile model) { arn(model.arn); packageCleanup(model.packageCleanup); excludeAppPackagesFromCleanup(model.excludeAppPackagesFromCleanup); rebootAfterUse(model.rebootAfterUse); name(model.name); description(model.description); } 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 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; } 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; } @Override public InstanceProfile build() { return new InstanceProfile(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy