software.amazon.awssdk.services.appstream.model.AppBlockBuilder 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.io.Serializable;
import java.time.Instant;
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.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;
/**
*
* Describes an app block builder.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AppBlockBuilder implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(AppBlockBuilder::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(AppBlockBuilder::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField DISPLAY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DisplayName").getter(getter(AppBlockBuilder::displayName)).setter(setter(Builder::displayName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DisplayName").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(AppBlockBuilder::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField PLATFORM_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Platform").getter(getter(AppBlockBuilder::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(AppBlockBuilder::instanceType)).setter(setter(Builder::instanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceType").build()).build();
private static final SdkField ENABLE_DEFAULT_INTERNET_ACCESS_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("EnableDefaultInternetAccess")
.getter(getter(AppBlockBuilder::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(AppBlockBuilder::iamRoleArn)).setter(setter(Builder::iamRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IamRoleArn").build()).build();
private static final SdkField VPC_CONFIG_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("VpcConfig").getter(getter(AppBlockBuilder::vpcConfig)).setter(setter(Builder::vpcConfig))
.constructor(VpcConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcConfig").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(AppBlockBuilder::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField CREATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedTime").getter(getter(AppBlockBuilder::createdTime)).setter(setter(Builder::createdTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTime").build()).build();
private static final SdkField> APP_BLOCK_BUILDER_ERRORS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AppBlockBuilderErrors")
.getter(getter(AppBlockBuilder::appBlockBuilderErrors))
.setter(setter(Builder::appBlockBuilderErrors))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AppBlockBuilderErrors").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ResourceError::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField STATE_CHANGE_REASON_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("StateChangeReason")
.getter(getter(AppBlockBuilder::stateChangeReason)).setter(setter(Builder::stateChangeReason))
.constructor(AppBlockBuilderStateChangeReason::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StateChangeReason").build()).build();
private static final SdkField> ACCESS_ENDPOINTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AccessEndpoints")
.getter(getter(AppBlockBuilder::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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, NAME_FIELD,
DISPLAY_NAME_FIELD, DESCRIPTION_FIELD, PLATFORM_FIELD, INSTANCE_TYPE_FIELD, ENABLE_DEFAULT_INTERNET_ACCESS_FIELD,
IAM_ROLE_ARN_FIELD, VPC_CONFIG_FIELD, STATE_FIELD, CREATED_TIME_FIELD, APP_BLOCK_BUILDER_ERRORS_FIELD,
STATE_CHANGE_REASON_FIELD, ACCESS_ENDPOINTS_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final String name;
private final String displayName;
private final String description;
private final String platform;
private final String instanceType;
private final Boolean enableDefaultInternetAccess;
private final String iamRoleArn;
private final VpcConfig vpcConfig;
private final String state;
private final Instant createdTime;
private final List appBlockBuilderErrors;
private final AppBlockBuilderStateChangeReason stateChangeReason;
private final List accessEndpoints;
private AppBlockBuilder(BuilderImpl builder) {
this.arn = builder.arn;
this.name = builder.name;
this.displayName = builder.displayName;
this.description = builder.description;
this.platform = builder.platform;
this.instanceType = builder.instanceType;
this.enableDefaultInternetAccess = builder.enableDefaultInternetAccess;
this.iamRoleArn = builder.iamRoleArn;
this.vpcConfig = builder.vpcConfig;
this.state = builder.state;
this.createdTime = builder.createdTime;
this.appBlockBuilderErrors = builder.appBlockBuilderErrors;
this.stateChangeReason = builder.stateChangeReason;
this.accessEndpoints = builder.accessEndpoints;
}
/**
*
* The ARN of the app block builder.
*
*
* @return The ARN of the app block builder.
*/
public final String arn() {
return arn;
}
/**
*
* The name of the app block builder.
*
*
* @return The name of the app block builder.
*/
public final String name() {
return name;
}
/**
*
* The display name of the app block builder.
*
*
* @return The display name of the app block builder.
*/
public final String displayName() {
return displayName;
}
/**
*
* The description of the app block builder.
*
*
* @return The description of the app block builder.
*/
public final String description() {
return description;
}
/**
*
* 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 AppBlockBuilderPlatformType#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 AppBlockBuilderPlatformType
*/
public final AppBlockBuilderPlatformType platform() {
return AppBlockBuilderPlatformType.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 AppBlockBuilderPlatformType#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 AppBlockBuilderPlatformType
*/
public final String platformAsString() {
return platform;
}
/**
*
* The instance type of the app block builder.
*
*
* @return The instance type of the app block builder.
*/
public final String instanceType() {
return instanceType;
}
/**
*
* Indicates whether default internet access is enabled for the app block builder.
*
*
* @return Indicates whether default internet access is enabled for the app block builder.
*/
public final Boolean enableDefaultInternetAccess() {
return enableDefaultInternetAccess;
}
/**
*
* The ARN of the IAM role that is applied to the app block builder.
*
*
* @return The ARN of the IAM role that is applied to the app block builder.
*/
public final String iamRoleArn() {
return iamRoleArn;
}
/**
*
* The VPC configuration for the app block builder.
*
*
* @return The VPC configuration for the app block builder.
*/
public final VpcConfig vpcConfig() {
return vpcConfig;
}
/**
*
* The state of the app block builder.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link AppBlockBuilderState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the app block builder.
* @see AppBlockBuilderState
*/
public final AppBlockBuilderState state() {
return AppBlockBuilderState.fromValue(state);
}
/**
*
* The state of the app block builder.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link AppBlockBuilderState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the app block builder.
* @see AppBlockBuilderState
*/
public final String stateAsString() {
return state;
}
/**
*
* The creation time of the app block builder.
*
*
* @return The creation time of the app block builder.
*/
public final Instant createdTime() {
return createdTime;
}
/**
* For responses, this returns true if the service returned a value for the AppBlockBuilderErrors 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 hasAppBlockBuilderErrors() {
return appBlockBuilderErrors != null && !(appBlockBuilderErrors instanceof SdkAutoConstructList);
}
/**
*
* The app block builder errors.
*
*
* 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 #hasAppBlockBuilderErrors} method.
*
*
* @return The app block builder errors.
*/
public final List appBlockBuilderErrors() {
return appBlockBuilderErrors;
}
/**
*
* The state change reason.
*
*
* @return The state change reason.
*/
public final AppBlockBuilderStateChangeReason stateChangeReason() {
return stateChangeReason;
}
/**
* 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;
}
@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 + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(displayName());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(platformAsString());
hashCode = 31 * hashCode + Objects.hashCode(instanceType());
hashCode = 31 * hashCode + Objects.hashCode(enableDefaultInternetAccess());
hashCode = 31 * hashCode + Objects.hashCode(iamRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(vpcConfig());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(createdTime());
hashCode = 31 * hashCode + Objects.hashCode(hasAppBlockBuilderErrors() ? appBlockBuilderErrors() : null);
hashCode = 31 * hashCode + Objects.hashCode(stateChangeReason());
hashCode = 31 * hashCode + Objects.hashCode(hasAccessEndpoints() ? accessEndpoints() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof AppBlockBuilder)) {
return false;
}
AppBlockBuilder other = (AppBlockBuilder) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(name(), other.name())
&& Objects.equals(displayName(), other.displayName()) && Objects.equals(description(), other.description())
&& Objects.equals(platformAsString(), other.platformAsString())
&& Objects.equals(instanceType(), other.instanceType())
&& Objects.equals(enableDefaultInternetAccess(), other.enableDefaultInternetAccess())
&& Objects.equals(iamRoleArn(), other.iamRoleArn()) && Objects.equals(vpcConfig(), other.vpcConfig())
&& Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(createdTime(), other.createdTime())
&& hasAppBlockBuilderErrors() == other.hasAppBlockBuilderErrors()
&& Objects.equals(appBlockBuilderErrors(), other.appBlockBuilderErrors())
&& Objects.equals(stateChangeReason(), other.stateChangeReason())
&& hasAccessEndpoints() == other.hasAccessEndpoints()
&& Objects.equals(accessEndpoints(), other.accessEndpoints());
}
/**
* 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("AppBlockBuilder").add("Arn", arn()).add("Name", name()).add("DisplayName", displayName())
.add("Description", description()).add("Platform", platformAsString()).add("InstanceType", instanceType())
.add("EnableDefaultInternetAccess", enableDefaultInternetAccess()).add("IamRoleArn", iamRoleArn())
.add("VpcConfig", vpcConfig()).add("State", stateAsString()).add("CreatedTime", createdTime())
.add("AppBlockBuilderErrors", hasAppBlockBuilderErrors() ? appBlockBuilderErrors() : null)
.add("StateChangeReason", stateChangeReason())
.add("AccessEndpoints", hasAccessEndpoints() ? accessEndpoints() : null).build();
}
public final 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 "DisplayName":
return Optional.ofNullable(clazz.cast(displayName()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "Platform":
return Optional.ofNullable(clazz.cast(platformAsString()));
case "InstanceType":
return Optional.ofNullable(clazz.cast(instanceType()));
case "EnableDefaultInternetAccess":
return Optional.ofNullable(clazz.cast(enableDefaultInternetAccess()));
case "IamRoleArn":
return Optional.ofNullable(clazz.cast(iamRoleArn()));
case "VpcConfig":
return Optional.ofNullable(clazz.cast(vpcConfig()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "CreatedTime":
return Optional.ofNullable(clazz.cast(createdTime()));
case "AppBlockBuilderErrors":
return Optional.ofNullable(clazz.cast(appBlockBuilderErrors()));
case "StateChangeReason":
return Optional.ofNullable(clazz.cast(stateChangeReason()));
case "AccessEndpoints":
return Optional.ofNullable(clazz.cast(accessEndpoints()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function