software.amazon.awssdk.services.deadline.model.StartSessionsStatisticsAggregationRequest Maven / Gradle / Ivy
Show all versions of deadline 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.deadline.model;
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 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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.TimestampFormatTrait;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class StartSessionsStatisticsAggregationRequest extends DeadlineRequest implements
ToCopyableBuilder {
private static final SdkField FARM_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("farmId")
.getter(getter(StartSessionsStatisticsAggregationRequest::farmId)).setter(setter(Builder::farmId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("farmId").build()).build();
private static final SdkField RESOURCE_IDS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("resourceIds")
.getter(getter(StartSessionsStatisticsAggregationRequest::resourceIds)).setter(setter(Builder::resourceIds))
.constructor(SessionsStatisticsResources::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceIds").build()).build();
private static final SdkField START_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("startTime")
.getter(getter(StartSessionsStatisticsAggregationRequest::startTime))
.setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField END_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("endTime")
.getter(getter(StartSessionsStatisticsAggregationRequest::endTime))
.setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("endTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField TIMEZONE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("timezone").getter(getter(StartSessionsStatisticsAggregationRequest::timezone))
.setter(setter(Builder::timezone))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("timezone").build()).build();
private static final SdkField PERIOD_FIELD = SdkField. builder(MarshallingType.STRING).memberName("period")
.getter(getter(StartSessionsStatisticsAggregationRequest::periodAsString)).setter(setter(Builder::period))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("period").build()).build();
private static final SdkField> GROUP_BY_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("groupBy")
.getter(getter(StartSessionsStatisticsAggregationRequest::groupByAsStrings))
.setter(setter(Builder::groupByWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("groupBy").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> STATISTICS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("statistics")
.getter(getter(StartSessionsStatisticsAggregationRequest::statisticsAsStrings))
.setter(setter(Builder::statisticsWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("statistics").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections
.unmodifiableList(Arrays.asList(FARM_ID_FIELD, RESOURCE_IDS_FIELD, START_TIME_FIELD, END_TIME_FIELD, TIMEZONE_FIELD,
PERIOD_FIELD, GROUP_BY_FIELD, STATISTICS_FIELD));
private final String farmId;
private final SessionsStatisticsResources resourceIds;
private final Instant startTime;
private final Instant endTime;
private final String timezone;
private final String period;
private final List groupBy;
private final List statistics;
private StartSessionsStatisticsAggregationRequest(BuilderImpl builder) {
super(builder);
this.farmId = builder.farmId;
this.resourceIds = builder.resourceIds;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.timezone = builder.timezone;
this.period = builder.period;
this.groupBy = builder.groupBy;
this.statistics = builder.statistics;
}
/**
*
* The identifier of the farm that contains queues or fleets to return statistics for.
*
*
* @return The identifier of the farm that contains queues or fleets to return statistics for.
*/
public final String farmId() {
return farmId;
}
/**
*
* A list of fleet IDs or queue IDs to gather statistics for.
*
*
* @return A list of fleet IDs or queue IDs to gather statistics for.
*/
public final SessionsStatisticsResources resourceIds() {
return resourceIds;
}
/**
*
* The Linux timestamp of the date and time that the statistics start.
*
*
* @return The Linux timestamp of the date and time that the statistics start.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The Linux timestamp of the date and time that the statistics end.
*
*
* @return The Linux timestamp of the date and time that the statistics end.
*/
public final Instant endTime() {
return endTime;
}
/**
*
* The timezone to use for the statistics. Use UTC notation such as "UTC+8."
*
*
* @return The timezone to use for the statistics. Use UTC notation such as "UTC+8."
*/
public final String timezone() {
return timezone;
}
/**
*
* The period to aggregate the statistics.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #period} will
* return {@link Period#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #periodAsString}.
*
*
* @return The period to aggregate the statistics.
* @see Period
*/
public final Period period() {
return Period.fromValue(period);
}
/**
*
* The period to aggregate the statistics.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #period} will
* return {@link Period#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #periodAsString}.
*
*
* @return The period to aggregate the statistics.
* @see Period
*/
public final String periodAsString() {
return period;
}
/**
*
* The field to use to group the statistics.
*
*
* 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 #hasGroupBy} method.
*
*
* @return The field to use to group the statistics.
*/
public final List groupBy() {
return UsageGroupByCopier.copyStringToEnum(groupBy);
}
/**
* For responses, this returns true if the service returned a value for the GroupBy 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 hasGroupBy() {
return groupBy != null && !(groupBy instanceof SdkAutoConstructList);
}
/**
*
* The field to use to group the statistics.
*
*
* 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 #hasGroupBy} method.
*
*
* @return The field to use to group the statistics.
*/
public final List groupByAsStrings() {
return groupBy;
}
/**
*
* One to four statistics to return.
*
*
* 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 #hasStatistics} method.
*
*
* @return One to four statistics to return.
*/
public final List statistics() {
return UsageStatisticsCopier.copyStringToEnum(statistics);
}
/**
* For responses, this returns true if the service returned a value for the Statistics 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 hasStatistics() {
return statistics != null && !(statistics instanceof SdkAutoConstructList);
}
/**
*
* One to four statistics to return.
*
*
* 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 #hasStatistics} method.
*
*
* @return One to four statistics to return.
*/
public final List statisticsAsStrings() {
return statistics;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(farmId());
hashCode = 31 * hashCode + Objects.hashCode(resourceIds());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(timezone());
hashCode = 31 * hashCode + Objects.hashCode(periodAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasGroupBy() ? groupByAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasStatistics() ? statisticsAsStrings() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof StartSessionsStatisticsAggregationRequest)) {
return false;
}
StartSessionsStatisticsAggregationRequest other = (StartSessionsStatisticsAggregationRequest) obj;
return Objects.equals(farmId(), other.farmId()) && Objects.equals(resourceIds(), other.resourceIds())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(endTime(), other.endTime())
&& Objects.equals(timezone(), other.timezone()) && Objects.equals(periodAsString(), other.periodAsString())
&& hasGroupBy() == other.hasGroupBy() && Objects.equals(groupByAsStrings(), other.groupByAsStrings())
&& hasStatistics() == other.hasStatistics() && Objects.equals(statisticsAsStrings(), other.statisticsAsStrings());
}
/**
* 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("StartSessionsStatisticsAggregationRequest").add("FarmId", farmId())
.add("ResourceIds", resourceIds()).add("StartTime", startTime()).add("EndTime", endTime())
.add("Timezone", timezone()).add("Period", periodAsString())
.add("GroupBy", hasGroupBy() ? groupByAsStrings() : null)
.add("Statistics", hasStatistics() ? statisticsAsStrings() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "farmId":
return Optional.ofNullable(clazz.cast(farmId()));
case "resourceIds":
return Optional.ofNullable(clazz.cast(resourceIds()));
case "startTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "endTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "timezone":
return Optional.ofNullable(clazz.cast(timezone()));
case "period":
return Optional.ofNullable(clazz.cast(periodAsString()));
case "groupBy":
return Optional.ofNullable(clazz.cast(groupByAsStrings()));
case "statistics":
return Optional.ofNullable(clazz.cast(statisticsAsStrings()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function