
software.amazon.awssdk.services.gamelift.model.SearchGameSessionsRequest Maven / Gradle / Ivy
/*
* 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.gamelift.model;
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.Consumer;
import java.util.function.Function;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents the input for a request action.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SearchGameSessionsRequest extends GameLiftRequest implements
ToCopyableBuilder {
private static final SdkField FLEET_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(SearchGameSessionsRequest::fleetId)).setter(setter(Builder::fleetId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FleetId").build()).build();
private static final SdkField ALIAS_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(SearchGameSessionsRequest::aliasId)).setter(setter(Builder::aliasId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AliasId").build()).build();
private static final SdkField FILTER_EXPRESSION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(SearchGameSessionsRequest::filterExpression)).setter(setter(Builder::filterExpression))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FilterExpression").build()).build();
private static final SdkField SORT_EXPRESSION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(SearchGameSessionsRequest::sortExpression)).setter(setter(Builder::sortExpression))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SortExpression").build()).build();
private static final SdkField LIMIT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(SearchGameSessionsRequest::limit)).setter(setter(Builder::limit))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Limit").build()).build();
private static final SdkField NEXT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(SearchGameSessionsRequest::nextToken)).setter(setter(Builder::nextToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NextToken").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FLEET_ID_FIELD,
ALIAS_ID_FIELD, FILTER_EXPRESSION_FIELD, SORT_EXPRESSION_FIELD, LIMIT_FIELD, NEXT_TOKEN_FIELD));
private final String fleetId;
private final String aliasId;
private final String filterExpression;
private final String sortExpression;
private final Integer limit;
private final String nextToken;
private SearchGameSessionsRequest(BuilderImpl builder) {
super(builder);
this.fleetId = builder.fleetId;
this.aliasId = builder.aliasId;
this.filterExpression = builder.filterExpression;
this.sortExpression = builder.sortExpression;
this.limit = builder.limit;
this.nextToken = builder.nextToken;
}
/**
*
* A unique identifier for a fleet to search for active game sessions. You can use either the fleet ID or ARN value.
* Each request must reference either a fleet ID or alias ID, but not both.
*
*
* @return A unique identifier for a fleet to search for active game sessions. You can use either the fleet ID or
* ARN value. Each request must reference either a fleet ID or alias ID, but not both.
*/
public String fleetId() {
return fleetId;
}
/**
*
* A unique identifier for an alias associated with the fleet to search for active game sessions. You can use either
* the alias ID or ARN value. Each request must reference either a fleet ID or alias ID, but not both.
*
*
* @return A unique identifier for an alias associated with the fleet to search for active game sessions. You can
* use either the alias ID or ARN value. Each request must reference either a fleet ID or alias ID, but not
* both.
*/
public String aliasId() {
return aliasId;
}
/**
*
* String containing the search criteria for the session search. If no filter expression is included, the request
* returns results for all game sessions in the fleet that are in ACTIVE
status.
*
*
* A filter expression can contain one or multiple conditions. Each condition consists of the following:
*
*
* -
*
* Operand -- Name of a game session attribute. Valid values are gameSessionName
,
* gameSessionId
, gameSessionProperties
, maximumSessions
,
* creationTimeMillis
, playerSessionCount
, hasAvailablePlayerSessions
.
*
*
* -
*
* Comparator -- Valid comparators are: =
, <>
, <
,
* >
, <=
, >=
.
*
*
* -
*
* Value -- Value to be searched for. Values may be numbers, boolean values (true/false) or strings depending
* on the operand. String values are case sensitive and must be enclosed in single quotes. Special characters must
* be escaped. Boolean and string values can only be used with the comparators =
and
* <>
. For example, the following filter expression searches on gameSessionName
: "
* FilterExpression": "gameSessionName = 'Matt\\'s Awesome Game 1'"
.
*
*
*
*
* To chain multiple conditions in a single expression, use the logical keywords AND
, OR
,
* and NOT
and parentheses as needed. For example: x AND y AND NOT z
,
* NOT (x OR y)
.
*
*
* Session search evaluates conditions from left to right using the following precedence rules:
*
*
* -
*
* =
, <>
, <
, >
, <=
,
* >=
*
*
* -
*
* Parentheses
*
*
* -
*
* NOT
*
*
* -
*
* AND
*
*
* -
*
* OR
*
*
*
*
* For example, this filter expression retrieves game sessions hosting at least ten players that have an open player
* slot: "maximumSessions>=10 AND hasAvailablePlayerSessions=true"
.
*
*
* @return String containing the search criteria for the session search. If no filter expression is included, the
* request returns results for all game sessions in the fleet that are in ACTIVE
status.
*
* A filter expression can contain one or multiple conditions. Each condition consists of the following:
*
*
* -
*
* Operand -- Name of a game session attribute. Valid values are gameSessionName
,
* gameSessionId
, gameSessionProperties
, maximumSessions
,
* creationTimeMillis
, playerSessionCount
, hasAvailablePlayerSessions
* .
*
*
* -
*
* Comparator -- Valid comparators are: =
, <>
, <
,
* >
, <=
, >=
.
*
*
* -
*
* Value -- Value to be searched for. Values may be numbers, boolean values (true/false) or strings
* depending on the operand. String values are case sensitive and must be enclosed in single quotes. Special
* characters must be escaped. Boolean and string values can only be used with the comparators
* =
and <>
. For example, the following filter expression searches on
* gameSessionName
: "
* FilterExpression": "gameSessionName = 'Matt\\'s Awesome Game 1'"
.
*
*
*
*
* To chain multiple conditions in a single expression, use the logical keywords AND
,
* OR
, and NOT
and parentheses as needed. For example:
* x AND y AND NOT z
, NOT (x OR y)
.
*
*
* Session search evaluates conditions from left to right using the following precedence rules:
*
*
* -
*
* =
, <>
, <
, >
, <=
,
* >=
*
*
* -
*
* Parentheses
*
*
* -
*
* NOT
*
*
* -
*
* AND
*
*
* -
*
* OR
*
*
*
*
* For example, this filter expression retrieves game sessions hosting at least ten players that have an
* open player slot: "maximumSessions>=10 AND hasAvailablePlayerSessions=true"
.
*/
public String filterExpression() {
return filterExpression;
}
/**
*
* Instructions on how to sort the search results. If no sort expression is included, the request returns results in
* random order. A sort expression consists of the following elements:
*
*
* -
*
* Operand -- Name of a game session attribute. Valid values are gameSessionName
,
* gameSessionId
, gameSessionProperties
, maximumSessions
,
* creationTimeMillis
, playerSessionCount
, hasAvailablePlayerSessions
.
*
*
* -
*
* Order -- Valid sort orders are ASC
(ascending) and DESC
(descending).
*
*
*
*
* For example, this sort expression returns the oldest active sessions first:
* "SortExpression": "creationTimeMillis ASC"
. Results with a null value for the sort operand are
* returned at the end of the list.
*
*
* @return Instructions on how to sort the search results. If no sort expression is included, the request returns
* results in random order. A sort expression consists of the following elements:
*
* -
*
* Operand -- Name of a game session attribute. Valid values are gameSessionName
,
* gameSessionId
, gameSessionProperties
, maximumSessions
,
* creationTimeMillis
, playerSessionCount
, hasAvailablePlayerSessions
* .
*
*
* -
*
* Order -- Valid sort orders are ASC
(ascending) and DESC
(descending).
*
*
*
*
* For example, this sort expression returns the oldest active sessions first:
* "SortExpression": "creationTimeMillis ASC"
. Results with a null value for the sort operand
* are returned at the end of the list.
*/
public String sortExpression() {
return sortExpression;
}
/**
*
* The maximum number of results to return. Use this parameter with NextToken
to get results as a set
* of sequential pages. The maximum number of results returned is 20, even if this value is not set or is set higher
* than 20.
*
*
* @return The maximum number of results to return. Use this parameter with NextToken
to get results as
* a set of sequential pages. The maximum number of results returned is 20, even if this value is not set or
* is set higher than 20.
*/
public Integer limit() {
return limit;
}
/**
*
* Token that indicates the start of the next sequential page of results. Use the token that is returned with a
* previous call to this action. To start at the beginning of the result set, do not specify a value.
*
*
* @return Token that indicates the start of the next sequential page of results. Use the token that is returned
* with a previous call to this action. To start at the beginning of the result set, do not specify a value.
*/
public String nextToken() {
return nextToken;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(fleetId());
hashCode = 31 * hashCode + Objects.hashCode(aliasId());
hashCode = 31 * hashCode + Objects.hashCode(filterExpression());
hashCode = 31 * hashCode + Objects.hashCode(sortExpression());
hashCode = 31 * hashCode + Objects.hashCode(limit());
hashCode = 31 * hashCode + Objects.hashCode(nextToken());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof SearchGameSessionsRequest)) {
return false;
}
SearchGameSessionsRequest other = (SearchGameSessionsRequest) obj;
return Objects.equals(fleetId(), other.fleetId()) && Objects.equals(aliasId(), other.aliasId())
&& Objects.equals(filterExpression(), other.filterExpression())
&& Objects.equals(sortExpression(), other.sortExpression()) && Objects.equals(limit(), other.limit())
&& Objects.equals(nextToken(), other.nextToken());
}
/**
* 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 String toString() {
return ToString.builder("SearchGameSessionsRequest").add("FleetId", fleetId()).add("AliasId", aliasId())
.add("FilterExpression", filterExpression()).add("SortExpression", sortExpression()).add("Limit", limit())
.add("NextToken", nextToken()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "FleetId":
return Optional.ofNullable(clazz.cast(fleetId()));
case "AliasId":
return Optional.ofNullable(clazz.cast(aliasId()));
case "FilterExpression":
return Optional.ofNullable(clazz.cast(filterExpression()));
case "SortExpression":
return Optional.ofNullable(clazz.cast(sortExpression()));
case "Limit":
return Optional.ofNullable(clazz.cast(limit()));
case "NextToken":
return Optional.ofNullable(clazz.cast(nextToken()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function