software.amazon.awssdk.services.codeguruprofiler.model.AggregatedProfileTime Maven / Gradle / Ivy
Show all versions of codeguruprofiler 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.codeguruprofiler.model;
import java.io.Serializable;
import java.time.Instant;
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.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Specifies the aggregation period and aggregation start time for an aggregated profile. An aggregated profile is used
* to collect posted agent profiles during an aggregation period. There are three possible aggregation periods (1 day, 1
* hour, or 5 minutes).
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AggregatedProfileTime implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField PERIOD_FIELD = SdkField. builder(MarshallingType.STRING).memberName("period")
.getter(getter(AggregatedProfileTime::periodAsString)).setter(setter(Builder::period))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("period").build()).build();
private static final SdkField START_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("start")
.getter(getter(AggregatedProfileTime::start))
.setter(setter(Builder::start))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("start").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PERIOD_FIELD, START_FIELD));
private static final long serialVersionUID = 1L;
private final String period;
private final Instant start;
private AggregatedProfileTime(BuilderImpl builder) {
this.period = builder.period;
this.start = builder.start;
}
/**
*
* The aggregation period. This indicates the period during which an aggregation profile collects posted agent
* profiles for a profiling group. Use one of three valid durations that are specified using the ISO 8601 format.
*
*
* -
*
* P1D
— 1 day
*
*
* -
*
* PT1H
— 1 hour
*
*
* -
*
* PT5M
— 5 minutes
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #period} will
* return {@link AggregationPeriod#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #periodAsString}.
*
*
* @return The aggregation period. This indicates the period during which an aggregation profile collects posted
* agent profiles for a profiling group. Use one of three valid durations that are specified using the ISO
* 8601 format.
*
* -
*
* P1D
— 1 day
*
*
* -
*
* PT1H
— 1 hour
*
*
* -
*
* PT5M
— 5 minutes
*
*
* @see AggregationPeriod
*/
public final AggregationPeriod period() {
return AggregationPeriod.fromValue(period);
}
/**
*
* The aggregation period. This indicates the period during which an aggregation profile collects posted agent
* profiles for a profiling group. Use one of three valid durations that are specified using the ISO 8601 format.
*
*
* -
*
* P1D
— 1 day
*
*
* -
*
* PT1H
— 1 hour
*
*
* -
*
* PT5M
— 5 minutes
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #period} will
* return {@link AggregationPeriod#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #periodAsString}.
*
*
* @return The aggregation period. This indicates the period during which an aggregation profile collects posted
* agent profiles for a profiling group. Use one of three valid durations that are specified using the ISO
* 8601 format.
*
* -
*
* P1D
— 1 day
*
*
* -
*
* PT1H
— 1 hour
*
*
* -
*
* PT5M
— 5 minutes
*
*
* @see AggregationPeriod
*/
public final String periodAsString() {
return period;
}
/**
*
* The time that aggregation of posted agent profiles for a profiling group starts. The aggregation profile contains
* profiles posted by the agent starting at this time for an aggregation period specified by the period
* property of the AggregatedProfileTime
object.
*
*
* Specify start
using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1
* millisecond past June 1, 2020 1:15:02 PM UTC.
*
*
* @return The time that aggregation of posted agent profiles for a profiling group starts. The aggregation profile
* contains profiles posted by the agent starting at this time for an aggregation period specified by the
* period
property of the AggregatedProfileTime
object.
*
* Specify start
using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1
* millisecond past June 1, 2020 1:15:02 PM UTC.
*/
public final Instant start() {
return start;
}
@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(periodAsString());
hashCode = 31 * hashCode + Objects.hashCode(start());
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 AggregatedProfileTime)) {
return false;
}
AggregatedProfileTime other = (AggregatedProfileTime) obj;
return Objects.equals(periodAsString(), other.periodAsString()) && Objects.equals(start(), other.start());
}
/**
* 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("AggregatedProfileTime").add("Period", periodAsString()).add("Start", start()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "period":
return Optional.ofNullable(clazz.cast(periodAsString()));
case "start":
return Optional.ofNullable(clazz.cast(start()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* -
*
* P1D
— 1 day
*
*
* -
*
* PT1H
— 1 hour
*
*
* -
*
* PT5M
— 5 minutes
*
*
* @see AggregationPeriod
* @return Returns a reference to this object so that method calls can be chained together.
* @see AggregationPeriod
*/
Builder period(String period);
/**
*
* The aggregation period. This indicates the period during which an aggregation profile collects posted agent
* profiles for a profiling group. Use one of three valid durations that are specified using the ISO 8601
* format.
*
*
* -
*
* P1D
— 1 day
*
*
* -
*
* PT1H
— 1 hour
*
*
* -
*
* PT5M
— 5 minutes
*
*
*
*
* @param period
* The aggregation period. This indicates the period during which an aggregation profile collects posted
* agent profiles for a profiling group. Use one of three valid durations that are specified using the
* ISO 8601 format.
*
* -
*
* P1D
— 1 day
*
*
* -
*
* PT1H
— 1 hour
*
*
* -
*
* PT5M
— 5 minutes
*
*
* @see AggregationPeriod
* @return Returns a reference to this object so that method calls can be chained together.
* @see AggregationPeriod
*/
Builder period(AggregationPeriod period);
/**
*
* The time that aggregation of posted agent profiles for a profiling group starts. The aggregation profile
* contains profiles posted by the agent starting at this time for an aggregation period specified by the
* period
property of the AggregatedProfileTime
object.
*
*
* Specify start
using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1
* millisecond past June 1, 2020 1:15:02 PM UTC.
*
*
* @param start
* The time that aggregation of posted agent profiles for a profiling group starts. The aggregation
* profile contains profiles posted by the agent starting at this time for an aggregation period
* specified by the period
property of the AggregatedProfileTime
object.
*
* Specify start
using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents
* 1 millisecond past June 1, 2020 1:15:02 PM UTC.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder start(Instant start);
}
static final class BuilderImpl implements Builder {
private String period;
private Instant start;
private BuilderImpl() {
}
private BuilderImpl(AggregatedProfileTime model) {
period(model.period);
start(model.start);
}
public final String getPeriod() {
return period;
}
public final void setPeriod(String period) {
this.period = period;
}
@Override
public final Builder period(String period) {
this.period = period;
return this;
}
@Override
public final Builder period(AggregationPeriod period) {
this.period(period == null ? null : period.toString());
return this;
}
public final Instant getStart() {
return start;
}
public final void setStart(Instant start) {
this.start = start;
}
@Override
public final Builder start(Instant start) {
this.start = start;
return this;
}
@Override
public AggregatedProfileTime build() {
return new AggregatedProfileTime(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}