software.amazon.awssdk.services.workspaces.model.CapacityStatus 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 capacity status for a pool of WorkSpaces.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CapacityStatus implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField AVAILABLE_USER_SESSIONS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("AvailableUserSessions").getter(getter(CapacityStatus::availableUserSessions))
.setter(setter(Builder::availableUserSessions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailableUserSessions").build())
.build();
private static final SdkField DESIRED_USER_SESSIONS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("DesiredUserSessions").getter(getter(CapacityStatus::desiredUserSessions))
.setter(setter(Builder::desiredUserSessions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DesiredUserSessions").build())
.build();
private static final SdkField ACTUAL_USER_SESSIONS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("ActualUserSessions").getter(getter(CapacityStatus::actualUserSessions))
.setter(setter(Builder::actualUserSessions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActualUserSessions").build())
.build();
private static final SdkField ACTIVE_USER_SESSIONS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("ActiveUserSessions").getter(getter(CapacityStatus::activeUserSessions))
.setter(setter(Builder::activeUserSessions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActiveUserSessions").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AVAILABLE_USER_SESSIONS_FIELD,
DESIRED_USER_SESSIONS_FIELD, ACTUAL_USER_SESSIONS_FIELD, ACTIVE_USER_SESSIONS_FIELD));
private static final long serialVersionUID = 1L;
private final Integer availableUserSessions;
private final Integer desiredUserSessions;
private final Integer actualUserSessions;
private final Integer activeUserSessions;
private CapacityStatus(BuilderImpl builder) {
this.availableUserSessions = builder.availableUserSessions;
this.desiredUserSessions = builder.desiredUserSessions;
this.actualUserSessions = builder.actualUserSessions;
this.activeUserSessions = builder.activeUserSessions;
}
/**
*
* The number of user sessions currently available for streaming from your pool.
*
*
* AvailableUserSessions = ActualUserSessions - ActiveUserSessions
*
*
* @return The number of user sessions currently available for streaming from your pool.
*
* AvailableUserSessions = ActualUserSessions - ActiveUserSessions
*/
public final Integer availableUserSessions() {
return availableUserSessions;
}
/**
*
* The total number of sessions slots that are either running or pending. This represents the total number of
* concurrent streaming sessions your pool can support in a steady state.
*
*
* @return The total number of sessions slots that are either running or pending. This represents the total number
* of concurrent streaming sessions your pool can support in a steady state.
*/
public final Integer desiredUserSessions() {
return desiredUserSessions;
}
/**
*
* The total number of user sessions that are available for streaming or are currently streaming in your pool.
*
*
* ActualUserSessions = AvailableUserSessions + ActiveUserSessions
*
*
* @return The total number of user sessions that are available for streaming or are currently streaming in your
* pool.
*
* ActualUserSessions = AvailableUserSessions + ActiveUserSessions
*/
public final Integer actualUserSessions() {
return actualUserSessions;
}
/**
*
* The number of user sessions currently being used for your pool.
*
*
* @return The number of user sessions currently being used for your pool.
*/
public final Integer activeUserSessions() {
return activeUserSessions;
}
@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(availableUserSessions());
hashCode = 31 * hashCode + Objects.hashCode(desiredUserSessions());
hashCode = 31 * hashCode + Objects.hashCode(actualUserSessions());
hashCode = 31 * hashCode + Objects.hashCode(activeUserSessions());
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 CapacityStatus)) {
return false;
}
CapacityStatus other = (CapacityStatus) obj;
return Objects.equals(availableUserSessions(), other.availableUserSessions())
&& Objects.equals(desiredUserSessions(), other.desiredUserSessions())
&& Objects.equals(actualUserSessions(), other.actualUserSessions())
&& Objects.equals(activeUserSessions(), other.activeUserSessions());
}
/**
* 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("CapacityStatus").add("AvailableUserSessions", availableUserSessions())
.add("DesiredUserSessions", desiredUserSessions()).add("ActualUserSessions", actualUserSessions())
.add("ActiveUserSessions", activeUserSessions()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AvailableUserSessions":
return Optional.ofNullable(clazz.cast(availableUserSessions()));
case "DesiredUserSessions":
return Optional.ofNullable(clazz.cast(desiredUserSessions()));
case "ActualUserSessions":
return Optional.ofNullable(clazz.cast(actualUserSessions()));
case "ActiveUserSessions":
return Optional.ofNullable(clazz.cast(activeUserSessions()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function