software.amazon.awssdk.services.appstream.model.UpdateAppBlockBuilderRequest Maven / Gradle / Ivy
Show all versions of appstream Show documentation
/*
* 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.appstream.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 UpdateAppBlockBuilderRequest extends AppStreamRequest implements
ToCopyableBuilder {
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(UpdateAppBlockBuilderRequest::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(UpdateAppBlockBuilderRequest::description))
.setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField DISPLAY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DisplayName").getter(getter(UpdateAppBlockBuilderRequest::displayName))
.setter(setter(Builder::displayName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DisplayName").build()).build();
private static final SdkField PLATFORM_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Platform").getter(getter(UpdateAppBlockBuilderRequest::platformAsString))
.setter(setter(Builder::platform))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Platform").build()).build();
private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceType").getter(getter(UpdateAppBlockBuilderRequest::instanceType))
.setter(setter(Builder::instanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceType").build()).build();
private static final SdkField VPC_CONFIG_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("VpcConfig").getter(getter(UpdateAppBlockBuilderRequest::vpcConfig)).setter(setter(Builder::vpcConfig))
.constructor(VpcConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcConfig").build()).build();
private static final SdkField ENABLE_DEFAULT_INTERNET_ACCESS_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("EnableDefaultInternetAccess")
.getter(getter(UpdateAppBlockBuilderRequest::enableDefaultInternetAccess))
.setter(setter(Builder::enableDefaultInternetAccess))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EnableDefaultInternetAccess")
.build()).build();
private static final SdkField IAM_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IamRoleArn").getter(getter(UpdateAppBlockBuilderRequest::iamRoleArn))
.setter(setter(Builder::iamRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IamRoleArn").build()).build();
private static final SdkField> ACCESS_ENDPOINTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AccessEndpoints")
.getter(getter(UpdateAppBlockBuilderRequest::accessEndpoints))
.setter(setter(Builder::accessEndpoints))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AccessEndpoints").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AccessEndpoint::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> ATTRIBUTES_TO_DELETE_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AttributesToDelete")
.getter(getter(UpdateAppBlockBuilderRequest::attributesToDeleteAsStrings))
.setter(setter(Builder::attributesToDeleteWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AttributesToDelete").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, DESCRIPTION_FIELD,
DISPLAY_NAME_FIELD, PLATFORM_FIELD, INSTANCE_TYPE_FIELD, VPC_CONFIG_FIELD, ENABLE_DEFAULT_INTERNET_ACCESS_FIELD,
IAM_ROLE_ARN_FIELD, ACCESS_ENDPOINTS_FIELD, ATTRIBUTES_TO_DELETE_FIELD));
private final String name;
private final String description;
private final String displayName;
private final String platform;
private final String instanceType;
private final VpcConfig vpcConfig;
private final Boolean enableDefaultInternetAccess;
private final String iamRoleArn;
private final List accessEndpoints;
private final List attributesToDelete;
private UpdateAppBlockBuilderRequest(BuilderImpl builder) {
super(builder);
this.name = builder.name;
this.description = builder.description;
this.displayName = builder.displayName;
this.platform = builder.platform;
this.instanceType = builder.instanceType;
this.vpcConfig = builder.vpcConfig;
this.enableDefaultInternetAccess = builder.enableDefaultInternetAccess;
this.iamRoleArn = builder.iamRoleArn;
this.accessEndpoints = builder.accessEndpoints;
this.attributesToDelete = builder.attributesToDelete;
}
/**
*
* The unique name for the app block builder.
*
*
* @return The unique name for the app block builder.
*/
public final String name() {
return name;
}
/**
*
* The description of the app block builder.
*
*
* @return The description of the app block builder.
*/
public final String description() {
return description;
}
/**
*
* The display name of the app block builder.
*
*
* @return The display name of the app block builder.
*/
public final String displayName() {
return displayName;
}
/**
*
* The platform of the app block builder.
*
*
* WINDOWS_SERVER_2019
is the only valid value.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #platform} will
* return {@link PlatformType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #platformAsString}.
*
*
* @return The platform of the app block builder.
*
* WINDOWS_SERVER_2019
is the only valid value.
* @see PlatformType
*/
public final PlatformType platform() {
return PlatformType.fromValue(platform);
}
/**
*
* The platform of the app block builder.
*
*
* WINDOWS_SERVER_2019
is the only valid value.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #platform} will
* return {@link PlatformType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #platformAsString}.
*
*
* @return The platform of the app block builder.
*
* WINDOWS_SERVER_2019
is the only valid value.
* @see PlatformType
*/
public final String platformAsString() {
return platform;
}
/**
*
* The instance type to use when launching the app block builder. The following instance types are available:
*
*
* -
*
* stream.standard.small
*
*
* -
*
* stream.standard.medium
*
*
* -
*
* stream.standard.large
*
*
* -
*
* stream.standard.xlarge
*
*
* -
*
* stream.standard.2xlarge
*
*
*
*
* @return The instance type to use when launching the app block builder. The following instance types are
* available:
*
* -
*
* stream.standard.small
*
*
* -
*
* stream.standard.medium
*
*
* -
*
* stream.standard.large
*
*
* -
*
* stream.standard.xlarge
*
*
* -
*
* stream.standard.2xlarge
*
*
*/
public final String instanceType() {
return instanceType;
}
/**
*
* The VPC configuration for the app block builder.
*
*
* App block builders require that you specify at least two subnets in different availability zones.
*
*
* @return The VPC configuration for the app block builder.
*
* App block builders require that you specify at least two subnets in different availability zones.
*/
public final VpcConfig vpcConfig() {
return vpcConfig;
}
/**
*
* Enables or disables default internet access for the app block builder.
*
*
* @return Enables or disables default internet access for the app block builder.
*/
public final Boolean enableDefaultInternetAccess() {
return enableDefaultInternetAccess;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM role to apply to the app block builder. To assume a role, the app block
* builder calls the AWS Security Token Service (STS) AssumeRole
API operation and passes the ARN of
* the role to use. The operation creates a new session with temporary credentials. AppStream 2.0 retrieves the
* temporary credentials and creates the appstream_machine_role credential profile on the instance.
*
*
* For more information, see Using an IAM Role to Grant Permissions to Applications and Scripts Running on AppStream 2.0 Streaming
* Instances in the Amazon AppStream 2.0 Administration Guide.
*
*
* @return The Amazon Resource Name (ARN) of the IAM role to apply to the app block builder. To assume a role, the
* app block builder calls the AWS Security Token Service (STS) AssumeRole
API operation and
* passes the ARN of the role to use. The operation creates a new session with temporary credentials.
* AppStream 2.0 retrieves the temporary credentials and creates the appstream_machine_role
* credential profile on the instance.
*
* For more information, see Using an IAM Role to Grant Permissions to Applications and Scripts Running on AppStream 2.0 Streaming
* Instances in the Amazon AppStream 2.0 Administration Guide.
*/
public final String iamRoleArn() {
return iamRoleArn;
}
/**
* For responses, this returns true if the service returned a value for the AccessEndpoints 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 hasAccessEndpoints() {
return accessEndpoints != null && !(accessEndpoints instanceof SdkAutoConstructList);
}
/**
*
* The list of interface VPC endpoint (interface endpoint) objects. Administrators can connect to the app block
* builder only through the specified endpoints.
*
*
* 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 #hasAccessEndpoints} method.
*
*
* @return The list of interface VPC endpoint (interface endpoint) objects. Administrators can connect to the app
* block builder only through the specified endpoints.
*/
public final List accessEndpoints() {
return accessEndpoints;
}
/**
*
* The attributes to delete from the app block builder.
*
*
* 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 #hasAttributesToDelete} method.
*
*
* @return The attributes to delete from the app block builder.
*/
public final List attributesToDelete() {
return AppBlockBuilderAttributesCopier.copyStringToEnum(attributesToDelete);
}
/**
* For responses, this returns true if the service returned a value for the AttributesToDelete 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 hasAttributesToDelete() {
return attributesToDelete != null && !(attributesToDelete instanceof SdkAutoConstructList);
}
/**
*
* The attributes to delete from the app block builder.
*
*
* 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 #hasAttributesToDelete} method.
*
*
* @return The attributes to delete from the app block builder.
*/
public final List attributesToDeleteAsStrings() {
return attributesToDelete;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(displayName());
hashCode = 31 * hashCode + Objects.hashCode(platformAsString());
hashCode = 31 * hashCode + Objects.hashCode(instanceType());
hashCode = 31 * hashCode + Objects.hashCode(vpcConfig());
hashCode = 31 * hashCode + Objects.hashCode(enableDefaultInternetAccess());
hashCode = 31 * hashCode + Objects.hashCode(iamRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(hasAccessEndpoints() ? accessEndpoints() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasAttributesToDelete() ? attributesToDeleteAsStrings() : 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 UpdateAppBlockBuilderRequest)) {
return false;
}
UpdateAppBlockBuilderRequest other = (UpdateAppBlockBuilderRequest) obj;
return Objects.equals(name(), other.name()) && Objects.equals(description(), other.description())
&& Objects.equals(displayName(), other.displayName())
&& Objects.equals(platformAsString(), other.platformAsString())
&& Objects.equals(instanceType(), other.instanceType()) && Objects.equals(vpcConfig(), other.vpcConfig())
&& Objects.equals(enableDefaultInternetAccess(), other.enableDefaultInternetAccess())
&& Objects.equals(iamRoleArn(), other.iamRoleArn()) && hasAccessEndpoints() == other.hasAccessEndpoints()
&& Objects.equals(accessEndpoints(), other.accessEndpoints())
&& hasAttributesToDelete() == other.hasAttributesToDelete()
&& Objects.equals(attributesToDeleteAsStrings(), other.attributesToDeleteAsStrings());
}
/**
* 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("UpdateAppBlockBuilderRequest").add("Name", name()).add("Description", description())
.add("DisplayName", displayName()).add("Platform", platformAsString()).add("InstanceType", instanceType())
.add("VpcConfig", vpcConfig()).add("EnableDefaultInternetAccess", enableDefaultInternetAccess())
.add("IamRoleArn", iamRoleArn()).add("AccessEndpoints", hasAccessEndpoints() ? accessEndpoints() : null)
.add("AttributesToDelete", hasAttributesToDelete() ? attributesToDeleteAsStrings() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "DisplayName":
return Optional.ofNullable(clazz.cast(displayName()));
case "Platform":
return Optional.ofNullable(clazz.cast(platformAsString()));
case "InstanceType":
return Optional.ofNullable(clazz.cast(instanceType()));
case "VpcConfig":
return Optional.ofNullable(clazz.cast(vpcConfig()));
case "EnableDefaultInternetAccess":
return Optional.ofNullable(clazz.cast(enableDefaultInternetAccess()));
case "IamRoleArn":
return Optional.ofNullable(clazz.cast(iamRoleArn()));
case "AccessEndpoints":
return Optional.ofNullable(clazz.cast(accessEndpoints()));
case "AttributesToDelete":
return Optional.ofNullable(clazz.cast(attributesToDeleteAsStrings()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function