software.amazon.awssdk.services.workspaces.model.SelfservicePermissions Maven / Gradle / Ivy
Show all versions of workspaces 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.workspaces.model;
import java.io.Serializable;
import java.util.Arrays;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Describes the self-service permissions for a directory. For more information, see Enable Self-Service WorkSpace Management Capabilities for Your Users.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SelfservicePermissions implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField RESTART_WORKSPACE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RestartWorkspace").getter(getter(SelfservicePermissions::restartWorkspaceAsString))
.setter(setter(Builder::restartWorkspace))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RestartWorkspace").build()).build();
private static final SdkField INCREASE_VOLUME_SIZE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IncreaseVolumeSize").getter(getter(SelfservicePermissions::increaseVolumeSizeAsString))
.setter(setter(Builder::increaseVolumeSize))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IncreaseVolumeSize").build())
.build();
private static final SdkField CHANGE_COMPUTE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ChangeComputeType").getter(getter(SelfservicePermissions::changeComputeTypeAsString))
.setter(setter(Builder::changeComputeType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChangeComputeType").build()).build();
private static final SdkField SWITCH_RUNNING_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SwitchRunningMode").getter(getter(SelfservicePermissions::switchRunningModeAsString))
.setter(setter(Builder::switchRunningMode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SwitchRunningMode").build()).build();
private static final SdkField REBUILD_WORKSPACE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RebuildWorkspace").getter(getter(SelfservicePermissions::rebuildWorkspaceAsString))
.setter(setter(Builder::rebuildWorkspace))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RebuildWorkspace").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RESTART_WORKSPACE_FIELD,
INCREASE_VOLUME_SIZE_FIELD, CHANGE_COMPUTE_TYPE_FIELD, SWITCH_RUNNING_MODE_FIELD, REBUILD_WORKSPACE_FIELD));
private static final long serialVersionUID = 1L;
private final String restartWorkspace;
private final String increaseVolumeSize;
private final String changeComputeType;
private final String switchRunningMode;
private final String rebuildWorkspace;
private SelfservicePermissions(BuilderImpl builder) {
this.restartWorkspace = builder.restartWorkspace;
this.increaseVolumeSize = builder.increaseVolumeSize;
this.changeComputeType = builder.changeComputeType;
this.switchRunningMode = builder.switchRunningMode;
this.rebuildWorkspace = builder.rebuildWorkspace;
}
/**
*
* Specifies whether users can restart their WorkSpace.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #restartWorkspace}
* will return {@link ReconnectEnum#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #restartWorkspaceAsString}.
*
*
* @return Specifies whether users can restart their WorkSpace.
* @see ReconnectEnum
*/
public final ReconnectEnum restartWorkspace() {
return ReconnectEnum.fromValue(restartWorkspace);
}
/**
*
* Specifies whether users can restart their WorkSpace.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #restartWorkspace}
* will return {@link ReconnectEnum#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #restartWorkspaceAsString}.
*
*
* @return Specifies whether users can restart their WorkSpace.
* @see ReconnectEnum
*/
public final String restartWorkspaceAsString() {
return restartWorkspace;
}
/**
*
* Specifies whether users can increase the volume size of the drives on their WorkSpace.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #increaseVolumeSize} will return {@link ReconnectEnum#UNKNOWN_TO_SDK_VERSION}. The raw value returned by
* the service is available from {@link #increaseVolumeSizeAsString}.
*
*
* @return Specifies whether users can increase the volume size of the drives on their WorkSpace.
* @see ReconnectEnum
*/
public final ReconnectEnum increaseVolumeSize() {
return ReconnectEnum.fromValue(increaseVolumeSize);
}
/**
*
* Specifies whether users can increase the volume size of the drives on their WorkSpace.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #increaseVolumeSize} will return {@link ReconnectEnum#UNKNOWN_TO_SDK_VERSION}. The raw value returned by
* the service is available from {@link #increaseVolumeSizeAsString}.
*
*
* @return Specifies whether users can increase the volume size of the drives on their WorkSpace.
* @see ReconnectEnum
*/
public final String increaseVolumeSizeAsString() {
return increaseVolumeSize;
}
/**
*
* Specifies whether users can change the compute type (bundle) for their WorkSpace.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #changeComputeType}
* will return {@link ReconnectEnum#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #changeComputeTypeAsString}.
*
*
* @return Specifies whether users can change the compute type (bundle) for their WorkSpace.
* @see ReconnectEnum
*/
public final ReconnectEnum changeComputeType() {
return ReconnectEnum.fromValue(changeComputeType);
}
/**
*
* Specifies whether users can change the compute type (bundle) for their WorkSpace.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #changeComputeType}
* will return {@link ReconnectEnum#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #changeComputeTypeAsString}.
*
*
* @return Specifies whether users can change the compute type (bundle) for their WorkSpace.
* @see ReconnectEnum
*/
public final String changeComputeTypeAsString() {
return changeComputeType;
}
/**
*
* Specifies whether users can switch the running mode of their WorkSpace.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #switchRunningMode}
* will return {@link ReconnectEnum#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #switchRunningModeAsString}.
*
*
* @return Specifies whether users can switch the running mode of their WorkSpace.
* @see ReconnectEnum
*/
public final ReconnectEnum switchRunningMode() {
return ReconnectEnum.fromValue(switchRunningMode);
}
/**
*
* Specifies whether users can switch the running mode of their WorkSpace.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #switchRunningMode}
* will return {@link ReconnectEnum#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #switchRunningModeAsString}.
*
*
* @return Specifies whether users can switch the running mode of their WorkSpace.
* @see ReconnectEnum
*/
public final String switchRunningModeAsString() {
return switchRunningMode;
}
/**
*
* Specifies whether users can rebuild the operating system of a WorkSpace to its original state.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #rebuildWorkspace}
* will return {@link ReconnectEnum#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #rebuildWorkspaceAsString}.
*
*
* @return Specifies whether users can rebuild the operating system of a WorkSpace to its original state.
* @see ReconnectEnum
*/
public final ReconnectEnum rebuildWorkspace() {
return ReconnectEnum.fromValue(rebuildWorkspace);
}
/**
*
* Specifies whether users can rebuild the operating system of a WorkSpace to its original state.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #rebuildWorkspace}
* will return {@link ReconnectEnum#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #rebuildWorkspaceAsString}.
*
*
* @return Specifies whether users can rebuild the operating system of a WorkSpace to its original state.
* @see ReconnectEnum
*/
public final String rebuildWorkspaceAsString() {
return rebuildWorkspace;
}
@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(restartWorkspaceAsString());
hashCode = 31 * hashCode + Objects.hashCode(increaseVolumeSizeAsString());
hashCode = 31 * hashCode + Objects.hashCode(changeComputeTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(switchRunningModeAsString());
hashCode = 31 * hashCode + Objects.hashCode(rebuildWorkspaceAsString());
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 SelfservicePermissions)) {
return false;
}
SelfservicePermissions other = (SelfservicePermissions) obj;
return Objects.equals(restartWorkspaceAsString(), other.restartWorkspaceAsString())
&& Objects.equals(increaseVolumeSizeAsString(), other.increaseVolumeSizeAsString())
&& Objects.equals(changeComputeTypeAsString(), other.changeComputeTypeAsString())
&& Objects.equals(switchRunningModeAsString(), other.switchRunningModeAsString())
&& Objects.equals(rebuildWorkspaceAsString(), other.rebuildWorkspaceAsString());
}
/**
* 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("SelfservicePermissions").add("RestartWorkspace", restartWorkspaceAsString())
.add("IncreaseVolumeSize", increaseVolumeSizeAsString()).add("ChangeComputeType", changeComputeTypeAsString())
.add("SwitchRunningMode", switchRunningModeAsString()).add("RebuildWorkspace", rebuildWorkspaceAsString())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "RestartWorkspace":
return Optional.ofNullable(clazz.cast(restartWorkspaceAsString()));
case "IncreaseVolumeSize":
return Optional.ofNullable(clazz.cast(increaseVolumeSizeAsString()));
case "ChangeComputeType":
return Optional.ofNullable(clazz.cast(changeComputeTypeAsString()));
case "SwitchRunningMode":
return Optional.ofNullable(clazz.cast(switchRunningModeAsString()));
case "RebuildWorkspace":
return Optional.ofNullable(clazz.cast(rebuildWorkspaceAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function