Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.codeguruprofiler.model.AgentConfiguration 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.codeguruprofiler.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
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.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The response of
* ConfigureAgent
that specifies if an agent profiles or not and for how long to return profiling
* data.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AgentConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField> AGENT_PARAMETERS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.getter(getter(AgentConfiguration::agentParametersAsStrings))
.setter(setter(Builder::agentParametersWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("agentParameters").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField PERIOD_IN_SECONDS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(AgentConfiguration::periodInSeconds)).setter(setter(Builder::periodInSeconds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("periodInSeconds").build()).build();
private static final SdkField SHOULD_PROFILE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(AgentConfiguration::shouldProfile)).setter(setter(Builder::shouldProfile))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("shouldProfile").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AGENT_PARAMETERS_FIELD,
PERIOD_IN_SECONDS_FIELD, SHOULD_PROFILE_FIELD));
private static final long serialVersionUID = 1L;
private final Map agentParameters;
private final Integer periodInSeconds;
private final Boolean shouldProfile;
private AgentConfiguration(BuilderImpl builder) {
this.agentParameters = builder.agentParameters;
this.periodInSeconds = builder.periodInSeconds;
this.shouldProfile = builder.shouldProfile;
}
/**
*
* Parameters used by the profiler. The valid parameters are:
*
*
*
*
* MaxStackDepth
- The maximum depth of the stacks in the code that is represented in the profile. For
* example, if CodeGuru Profiler finds a method A
, which calls method B
, which calls
* method C
, which calls method D
, then the depth is 4. If the maxDepth
is
* set to 2, then the profiler evaluates A
and B
.
*
*
*
*
* MemoryUsageLimitPercent
- The percentage of memory that is used by the profiler.
*
*
*
*
* MinimumTimeForReportingInMilliseconds
- The minimum time in milliseconds between sending reports.
*
*
*
*
* ReportingIntervalInMilliseconds
- The reporting interval in milliseconds used to report profiles.
*
*
*
*
* SamplingIntervalInMilliseconds
- The sampling interval in milliseconds that is used to profile
* samples.
*
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasAgentParameters()} to see if a value was sent in this field.
*
*
* @return Parameters used by the profiler. The valid parameters are:
*
*
*
* MaxStackDepth
- The maximum depth of the stacks in the code that is represented in the
* profile. For example, if CodeGuru Profiler finds a method A
, which calls method
* B
, which calls method C
, which calls method D
, then the depth is
* 4. If the maxDepth
is set to 2, then the profiler evaluates A
and
* B
.
*
*
*
*
* MemoryUsageLimitPercent
- The percentage of memory that is used by the profiler.
*
*
*
*
* MinimumTimeForReportingInMilliseconds
- The minimum time in milliseconds between sending
* reports.
*
*
*
*
* ReportingIntervalInMilliseconds
- The reporting interval in milliseconds used to report
* profiles.
*
*
*
*
* SamplingIntervalInMilliseconds
- The sampling interval in milliseconds that is used to
* profile samples.
*
*
*/
public Map agentParameters() {
return AgentParametersCopier.copyStringToEnum(agentParameters);
}
/**
* Returns true if the AgentParameters property was specified by the sender (it may be empty), or false if the
* sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS
* service.
*/
public boolean hasAgentParameters() {
return agentParameters != null && !(agentParameters instanceof SdkAutoConstructMap);
}
/**
*
* Parameters used by the profiler. The valid parameters are:
*
*
*
*
* MaxStackDepth
- The maximum depth of the stacks in the code that is represented in the profile. For
* example, if CodeGuru Profiler finds a method A
, which calls method B
, which calls
* method C
, which calls method D
, then the depth is 4. If the maxDepth
is
* set to 2, then the profiler evaluates A
and B
.
*
*
*
*
* MemoryUsageLimitPercent
- The percentage of memory that is used by the profiler.
*
*
*
*
* MinimumTimeForReportingInMilliseconds
- The minimum time in milliseconds between sending reports.
*
*
*
*
* ReportingIntervalInMilliseconds
- The reporting interval in milliseconds used to report profiles.
*
*
*
*
* SamplingIntervalInMilliseconds
- The sampling interval in milliseconds that is used to profile
* samples.
*
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasAgentParameters()} to see if a value was sent in this field.
*
*
* @return Parameters used by the profiler. The valid parameters are:
*
*
*
* MaxStackDepth
- The maximum depth of the stacks in the code that is represented in the
* profile. For example, if CodeGuru Profiler finds a method A
, which calls method
* B
, which calls method C
, which calls method D
, then the depth is
* 4. If the maxDepth
is set to 2, then the profiler evaluates A
and
* B
.
*
*
*
*
* MemoryUsageLimitPercent
- The percentage of memory that is used by the profiler.
*
*
*
*
* MinimumTimeForReportingInMilliseconds
- The minimum time in milliseconds between sending
* reports.
*
*
*
*
* ReportingIntervalInMilliseconds
- The reporting interval in milliseconds used to report
* profiles.
*
*
*
*
* SamplingIntervalInMilliseconds
- The sampling interval in milliseconds that is used to
* profile samples.
*
*
*/
public Map agentParametersAsStrings() {
return agentParameters;
}
/**
*
* How long a profiling agent should send profiling data using
* ConfigureAgent
. For example, if this is set to 300, the profiling agent calls
* ConfigureAgent
every 5 minutes to submit the profiled data collected during that period.
*
*
* @return How long a profiling agent should send profiling data using
* ConfigureAgent
. For example, if this is set to 300, the profiling agent calls
* ConfigureAgent
every 5 minutes to submit the profiled data collected during that
* period.
*/
public Integer periodInSeconds() {
return periodInSeconds;
}
/**
*
* A Boolean
that specifies whether the profiling agent collects profiling data or not. Set to
* true
to enable profiling.
*
*
* @return A Boolean
that specifies whether the profiling agent collects profiling data or not. Set to
* true
to enable profiling.
*/
public Boolean shouldProfile() {
return shouldProfile;
}
@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 + Objects.hashCode(agentParametersAsStrings());
hashCode = 31 * hashCode + Objects.hashCode(periodInSeconds());
hashCode = 31 * hashCode + Objects.hashCode(shouldProfile());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof AgentConfiguration)) {
return false;
}
AgentConfiguration other = (AgentConfiguration) obj;
return Objects.equals(agentParametersAsStrings(), other.agentParametersAsStrings())
&& Objects.equals(periodInSeconds(), other.periodInSeconds())
&& Objects.equals(shouldProfile(), other.shouldProfile());
}
/**
* 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("AgentConfiguration").add("AgentParameters", agentParametersAsStrings())
.add("PeriodInSeconds", periodInSeconds()).add("ShouldProfile", shouldProfile()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "agentParameters":
return Optional.ofNullable(clazz.cast(agentParametersAsStrings()));
case "periodInSeconds":
return Optional.ofNullable(clazz.cast(periodInSeconds()));
case "shouldProfile":
return Optional.ofNullable(clazz.cast(shouldProfile()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((AgentConfiguration) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* Parameters used by the profiler. The valid parameters are:
*
*
*
*
* MaxStackDepth
- The maximum depth of the stacks in the code that is represented in the profile.
* For example, if CodeGuru Profiler finds a method A
, which calls method B
, which
* calls method C
, which calls method D
, then the depth is 4. If the
* maxDepth
is set to 2, then the profiler evaluates A
and B
.
*
*
*
*
* MemoryUsageLimitPercent
- The percentage of memory that is used by the profiler.
*
*
*
*
* MinimumTimeForReportingInMilliseconds
- The minimum time in milliseconds between sending
* reports.
*
*
*
*
* ReportingIntervalInMilliseconds
- The reporting interval in milliseconds used to report
* profiles.
*
*
*
*
* SamplingIntervalInMilliseconds
- The sampling interval in milliseconds that is used to profile
* samples.
*
*
*
*
* @param agentParameters
* Parameters used by the profiler. The valid parameters are:
*
*
*
* MaxStackDepth
- The maximum depth of the stacks in the code that is represented in the
* profile. For example, if CodeGuru Profiler finds a method A
, which calls method
* B
, which calls method C
, which calls method D
, then the depth
* is 4. If the maxDepth
is set to 2, then the profiler evaluates A
and
* B
.
*
*
*
*
* MemoryUsageLimitPercent
- The percentage of memory that is used by the profiler.
*
*
*
*
* MinimumTimeForReportingInMilliseconds
- The minimum time in milliseconds between sending
* reports.
*
*
*
*
* ReportingIntervalInMilliseconds
- The reporting interval in milliseconds used to report
* profiles.
*
*
*
*
* SamplingIntervalInMilliseconds
- The sampling interval in milliseconds that is used to
* profile samples.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder agentParametersWithStrings(Map agentParameters);
/**
*
* Parameters used by the profiler. The valid parameters are:
*
*
*
*
* MaxStackDepth
- The maximum depth of the stacks in the code that is represented in the profile.
* For example, if CodeGuru Profiler finds a method A
, which calls method B
, which
* calls method C
, which calls method D
, then the depth is 4. If the
* maxDepth
is set to 2, then the profiler evaluates A
and B
.
*
*
*
*
* MemoryUsageLimitPercent
- The percentage of memory that is used by the profiler.
*
*
*
*
* MinimumTimeForReportingInMilliseconds
- The minimum time in milliseconds between sending
* reports.
*
*
*
*
* ReportingIntervalInMilliseconds
- The reporting interval in milliseconds used to report
* profiles.
*
*
*
*
* SamplingIntervalInMilliseconds
- The sampling interval in milliseconds that is used to profile
* samples.
*
*
*
*
* @param agentParameters
* Parameters used by the profiler. The valid parameters are:
*
*
*
* MaxStackDepth
- The maximum depth of the stacks in the code that is represented in the
* profile. For example, if CodeGuru Profiler finds a method A
, which calls method
* B
, which calls method C
, which calls method D
, then the depth
* is 4. If the maxDepth
is set to 2, then the profiler evaluates A
and
* B
.
*
*
*
*
* MemoryUsageLimitPercent
- The percentage of memory that is used by the profiler.
*
*
*
*
* MinimumTimeForReportingInMilliseconds
- The minimum time in milliseconds between sending
* reports.
*
*
*
*
* ReportingIntervalInMilliseconds
- The reporting interval in milliseconds used to report
* profiles.
*
*
*
*
* SamplingIntervalInMilliseconds
- The sampling interval in milliseconds that is used to
* profile samples.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder agentParameters(Map agentParameters);
/**
*
* How long a profiling agent should send profiling data using
* ConfigureAgent
. For example, if this is set to 300, the profiling agent calls
* ConfigureAgent
every 5 minutes to submit the profiled data collected during that period.
*
*
* @param periodInSeconds
* How long a profiling agent should send profiling data using
* ConfigureAgent
. For example, if this is set to 300, the profiling agent calls
* ConfigureAgent
every 5 minutes to submit the profiled data collected during that
* period.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder periodInSeconds(Integer periodInSeconds);
/**
*
* A Boolean
that specifies whether the profiling agent collects profiling data or not. Set to
* true
to enable profiling.
*
*
* @param shouldProfile
* A Boolean
that specifies whether the profiling agent collects profiling data or not. Set
* to true
to enable profiling.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder shouldProfile(Boolean shouldProfile);
}
static final class BuilderImpl implements Builder {
private Map agentParameters = DefaultSdkAutoConstructMap.getInstance();
private Integer periodInSeconds;
private Boolean shouldProfile;
private BuilderImpl() {
}
private BuilderImpl(AgentConfiguration model) {
agentParametersWithStrings(model.agentParameters);
periodInSeconds(model.periodInSeconds);
shouldProfile(model.shouldProfile);
}
public final Map getAgentParameters() {
return agentParameters;
}
@Override
public final Builder agentParametersWithStrings(Map agentParameters) {
this.agentParameters = AgentParametersCopier.copy(agentParameters);
return this;
}
@Override
public final Builder agentParameters(Map agentParameters) {
this.agentParameters = AgentParametersCopier.copyEnumToString(agentParameters);
return this;
}
public final void setAgentParameters(Map agentParameters) {
this.agentParameters = AgentParametersCopier.copy(agentParameters);
}
public final Integer getPeriodInSeconds() {
return periodInSeconds;
}
@Override
public final Builder periodInSeconds(Integer periodInSeconds) {
this.periodInSeconds = periodInSeconds;
return this;
}
public final void setPeriodInSeconds(Integer periodInSeconds) {
this.periodInSeconds = periodInSeconds;
}
public final Boolean getShouldProfile() {
return shouldProfile;
}
@Override
public final Builder shouldProfile(Boolean shouldProfile) {
this.shouldProfile = shouldProfile;
return this;
}
public final void setShouldProfile(Boolean shouldProfile) {
this.shouldProfile = shouldProfile;
}
@Override
public AgentConfiguration build() {
return new AgentConfiguration(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}