software.amazon.awssdk.services.appstream.model.Stack Maven / Gradle / Ivy
/*
* Copyright 2013-2018 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.time.Instant;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.services.appstream.transform.StackMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Describes a stack.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Stack implements StructuredPojo, ToCopyableBuilder {
private final String arn;
private final String name;
private final String description;
private final String displayName;
private final Instant createdTime;
private final List storageConnectors;
private final String redirectURL;
private final String feedbackURL;
private final List stackErrors;
private final List userSettings;
private final ApplicationSettingsResponse applicationSettings;
private Stack(BuilderImpl builder) {
this.arn = builder.arn;
this.name = builder.name;
this.description = builder.description;
this.displayName = builder.displayName;
this.createdTime = builder.createdTime;
this.storageConnectors = builder.storageConnectors;
this.redirectURL = builder.redirectURL;
this.feedbackURL = builder.feedbackURL;
this.stackErrors = builder.stackErrors;
this.userSettings = builder.userSettings;
this.applicationSettings = builder.applicationSettings;
}
/**
*
* The ARN of the stack.
*
*
* @return The ARN of the stack.
*/
public String arn() {
return arn;
}
/**
*
* The name of the stack.
*
*
* @return The name of the stack.
*/
public String name() {
return name;
}
/**
*
* The description for display.
*
*
* @return The description for display.
*/
public String description() {
return description;
}
/**
*
* The stack name for display.
*
*
* @return The stack name for display.
*/
public String displayName() {
return displayName;
}
/**
*
* The time the stack was created.
*
*
* @return The time the stack was created.
*/
public Instant createdTime() {
return createdTime;
}
/**
*
* The storage connectors to enable.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The storage connectors to enable.
*/
public List storageConnectors() {
return storageConnectors;
}
/**
*
* The URL that users are redirected to after their streaming session ends.
*
*
* @return The URL that users are redirected to after their streaming session ends.
*/
public String redirectURL() {
return redirectURL;
}
/**
*
* The URL that users are redirected to after they click the Send Feedback link. If no URL is specified, no Send
* Feedback link is displayed.
*
*
* @return The URL that users are redirected to after they click the Send Feedback link. If no URL is specified, no
* Send Feedback link is displayed.
*/
public String feedbackURL() {
return feedbackURL;
}
/**
*
* The errors for the stack.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The errors for the stack.
*/
public List stackErrors() {
return stackErrors;
}
/**
*
* The actions that are enabled or disabled for users during their streaming sessions. By default these actions are
* enabled.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The actions that are enabled or disabled for users during their streaming sessions. By default these
* actions are enabled.
*/
public List userSettings() {
return userSettings;
}
/**
*
* The persistent application settings for users of the stack.
*
*
* @return The persistent application settings for users of the stack.
*/
public ApplicationSettingsResponse applicationSettings() {
return applicationSettings;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(displayName());
hashCode = 31 * hashCode + Objects.hashCode(createdTime());
hashCode = 31 * hashCode + Objects.hashCode(storageConnectors());
hashCode = 31 * hashCode + Objects.hashCode(redirectURL());
hashCode = 31 * hashCode + Objects.hashCode(feedbackURL());
hashCode = 31 * hashCode + Objects.hashCode(stackErrors());
hashCode = 31 * hashCode + Objects.hashCode(userSettings());
hashCode = 31 * hashCode + Objects.hashCode(applicationSettings());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Stack)) {
return false;
}
Stack other = (Stack) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(name(), other.name())
&& Objects.equals(description(), other.description()) && Objects.equals(displayName(), other.displayName())
&& Objects.equals(createdTime(), other.createdTime())
&& Objects.equals(storageConnectors(), other.storageConnectors())
&& Objects.equals(redirectURL(), other.redirectURL()) && Objects.equals(feedbackURL(), other.feedbackURL())
&& Objects.equals(stackErrors(), other.stackErrors()) && Objects.equals(userSettings(), other.userSettings())
&& Objects.equals(applicationSettings(), other.applicationSettings());
}
@Override
public String toString() {
return ToString.builder("Stack").add("Arn", arn()).add("Name", name()).add("Description", description())
.add("DisplayName", displayName()).add("CreatedTime", createdTime())
.add("StorageConnectors", storageConnectors()).add("RedirectURL", redirectURL())
.add("FeedbackURL", feedbackURL()).add("StackErrors", stackErrors()).add("UserSettings", userSettings())
.add("ApplicationSettings", applicationSettings()).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 "DisplayName":
return Optional.ofNullable(clazz.cast(displayName()));
case "CreatedTime":
return Optional.ofNullable(clazz.cast(createdTime()));
case "StorageConnectors":
return Optional.ofNullable(clazz.cast(storageConnectors()));
case "RedirectURL":
return Optional.ofNullable(clazz.cast(redirectURL()));
case "FeedbackURL":
return Optional.ofNullable(clazz.cast(feedbackURL()));
case "StackErrors":
return Optional.ofNullable(clazz.cast(stackErrors()));
case "UserSettings":
return Optional.ofNullable(clazz.cast(userSettings()));
case "ApplicationSettings":
return Optional.ofNullable(clazz.cast(applicationSettings()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
StackMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The ARN of the stack.
*
*
* @param arn
* The ARN of the stack.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder arn(String arn);
/**
*
* The name of the stack.
*
*
* @param name
* The name of the stack.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder name(String name);
/**
*
* The description for display.
*
*
* @param description
* The description for display.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder description(String description);
/**
*
* The stack name for display.
*
*
* @param displayName
* The stack name for display.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder displayName(String displayName);
/**
*
* The time the stack was created.
*
*
* @param createdTime
* The time the stack was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder createdTime(Instant createdTime);
/**
*
* The storage connectors to enable.
*
*
* @param storageConnectors
* The storage connectors to enable.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder storageConnectors(Collection storageConnectors);
/**
*
* The storage connectors to enable.
*
*
* @param storageConnectors
* The storage connectors to enable.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder storageConnectors(StorageConnector... storageConnectors);
/**
*
* The storage connectors to enable.
*
* 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 #storageConnectors(List)}.
*
* @param storageConnectors
* 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 #storageConnectors(List)
*/
Builder storageConnectors(Consumer... storageConnectors);
/**
*
* The URL that users are redirected to after their streaming session ends.
*
*
* @param redirectURL
* The URL that users are redirected to after their streaming session ends.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder redirectURL(String redirectURL);
/**
*
* The URL that users are redirected to after they click the Send Feedback link. If no URL is specified, no Send
* Feedback link is displayed.
*
*
* @param feedbackURL
* The URL that users are redirected to after they click the Send Feedback link. If no URL is specified,
* no Send Feedback link is displayed.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder feedbackURL(String feedbackURL);
/**
*
* The errors for the stack.
*
*
* @param stackErrors
* The errors for the stack.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stackErrors(Collection stackErrors);
/**
*
* The errors for the stack.
*
*
* @param stackErrors
* The errors for the stack.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stackErrors(StackError... stackErrors);
/**
*
* The errors for the stack.
*
* 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 #stackErrors(List)}.
*
* @param stackErrors
* 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 #stackErrors(List)
*/
Builder stackErrors(Consumer... stackErrors);
/**
*
* The actions that are enabled or disabled for users during their streaming sessions. By default these actions
* are enabled.
*
*
* @param userSettings
* The actions that are enabled or disabled for users during their streaming sessions. By default these
* actions are enabled.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder userSettings(Collection userSettings);
/**
*
* The actions that are enabled or disabled for users during their streaming sessions. By default these actions
* are enabled.
*
*
* @param userSettings
* The actions that are enabled or disabled for users during their streaming sessions. By default these
* actions are enabled.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder userSettings(UserSetting... userSettings);
/**
*
* The actions that are enabled or disabled for users during their streaming sessions. By default these actions
* are enabled.
*
* 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 #userSettings(List)}.
*
* @param userSettings
* 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 #userSettings(List)
*/
Builder userSettings(Consumer... userSettings);
/**
*
* The persistent application settings for users of the stack.
*
*
* @param applicationSettings
* The persistent application settings for users of the stack.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder applicationSettings(ApplicationSettingsResponse applicationSettings);
/**
*
* The persistent application settings for users of the stack.
*
* This is a convenience that creates an instance of the {@link ApplicationSettingsResponse.Builder} avoiding
* the need to create one manually via {@link ApplicationSettingsResponse#builder()}.
*
* When the {@link Consumer} completes, {@link ApplicationSettingsResponse.Builder#build()} is called
* immediately and its result is passed to {@link #applicationSettings(ApplicationSettingsResponse)}.
*
* @param applicationSettings
* a consumer that will call methods on {@link ApplicationSettingsResponse.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #applicationSettings(ApplicationSettingsResponse)
*/
default Builder applicationSettings(Consumer applicationSettings) {
return applicationSettings(ApplicationSettingsResponse.builder().applyMutation(applicationSettings).build());
}
}
static final class BuilderImpl implements Builder {
private String arn;
private String name;
private String description;
private String displayName;
private Instant createdTime;
private List storageConnectors = DefaultSdkAutoConstructList.getInstance();
private String redirectURL;
private String feedbackURL;
private List stackErrors = DefaultSdkAutoConstructList.getInstance();
private List userSettings = DefaultSdkAutoConstructList.getInstance();
private ApplicationSettingsResponse applicationSettings;
private BuilderImpl() {
}
private BuilderImpl(Stack model) {
arn(model.arn);
name(model.name);
description(model.description);
displayName(model.displayName);
createdTime(model.createdTime);
storageConnectors(model.storageConnectors);
redirectURL(model.redirectURL);
feedbackURL(model.feedbackURL);
stackErrors(model.stackErrors);
userSettings(model.userSettings);
applicationSettings(model.applicationSettings);
}
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 String getDisplayName() {
return displayName;
}
@Override
public final Builder displayName(String displayName) {
this.displayName = displayName;
return this;
}
public final void setDisplayName(String displayName) {
this.displayName = displayName;
}
public final Instant getCreatedTime() {
return createdTime;
}
@Override
public final Builder createdTime(Instant createdTime) {
this.createdTime = createdTime;
return this;
}
public final void setCreatedTime(Instant createdTime) {
this.createdTime = createdTime;
}
public final Collection getStorageConnectors() {
return storageConnectors != null ? storageConnectors.stream().map(StorageConnector::toBuilder)
.collect(Collectors.toList()) : null;
}
@Override
public final Builder storageConnectors(Collection storageConnectors) {
this.storageConnectors = StorageConnectorListCopier.copy(storageConnectors);
return this;
}
@Override
@SafeVarargs
public final Builder storageConnectors(StorageConnector... storageConnectors) {
storageConnectors(Arrays.asList(storageConnectors));
return this;
}
@Override
@SafeVarargs
public final Builder storageConnectors(Consumer... storageConnectors) {
storageConnectors(Stream.of(storageConnectors).map(c -> StorageConnector.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final void setStorageConnectors(Collection storageConnectors) {
this.storageConnectors = StorageConnectorListCopier.copyFromBuilder(storageConnectors);
}
public final String getRedirectURL() {
return redirectURL;
}
@Override
public final Builder redirectURL(String redirectURL) {
this.redirectURL = redirectURL;
return this;
}
public final void setRedirectURL(String redirectURL) {
this.redirectURL = redirectURL;
}
public final String getFeedbackURL() {
return feedbackURL;
}
@Override
public final Builder feedbackURL(String feedbackURL) {
this.feedbackURL = feedbackURL;
return this;
}
public final void setFeedbackURL(String feedbackURL) {
this.feedbackURL = feedbackURL;
}
public final Collection getStackErrors() {
return stackErrors != null ? stackErrors.stream().map(StackError::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder stackErrors(Collection stackErrors) {
this.stackErrors = StackErrorsCopier.copy(stackErrors);
return this;
}
@Override
@SafeVarargs
public final Builder stackErrors(StackError... stackErrors) {
stackErrors(Arrays.asList(stackErrors));
return this;
}
@Override
@SafeVarargs
public final Builder stackErrors(Consumer... stackErrors) {
stackErrors(Stream.of(stackErrors).map(c -> StackError.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final void setStackErrors(Collection stackErrors) {
this.stackErrors = StackErrorsCopier.copyFromBuilder(stackErrors);
}
public final Collection getUserSettings() {
return userSettings != null ? userSettings.stream().map(UserSetting::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder userSettings(Collection userSettings) {
this.userSettings = UserSettingListCopier.copy(userSettings);
return this;
}
@Override
@SafeVarargs
public final Builder userSettings(UserSetting... userSettings) {
userSettings(Arrays.asList(userSettings));
return this;
}
@Override
@SafeVarargs
public final Builder userSettings(Consumer... userSettings) {
userSettings(Stream.of(userSettings).map(c -> UserSetting.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final void setUserSettings(Collection userSettings) {
this.userSettings = UserSettingListCopier.copyFromBuilder(userSettings);
}
public final ApplicationSettingsResponse.Builder getApplicationSettings() {
return applicationSettings != null ? applicationSettings.toBuilder() : null;
}
@Override
public final Builder applicationSettings(ApplicationSettingsResponse applicationSettings) {
this.applicationSettings = applicationSettings;
return this;
}
public final void setApplicationSettings(ApplicationSettingsResponse.BuilderImpl applicationSettings) {
this.applicationSettings = applicationSettings != null ? applicationSettings.build() : null;
}
@Override
public Stack build() {
return new Stack(this);
}
}
}