software.amazon.awssdk.services.pinpoint.model.WriteApplicationSettingsRequest Maven / Gradle / Ivy
Show all versions of pinpoint 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.pinpoint.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.Consumer;
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;
/**
*
* Specifies the default settings for an application.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class WriteApplicationSettingsRequest implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CAMPAIGN_HOOK_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("CampaignHook").getter(getter(WriteApplicationSettingsRequest::campaignHook))
.setter(setter(Builder::campaignHook)).constructor(CampaignHook::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CampaignHook").build()).build();
private static final SdkField CLOUD_WATCH_METRICS_ENABLED_FIELD = SdkField
. builder(MarshallingType.BOOLEAN).memberName("CloudWatchMetricsEnabled")
.getter(getter(WriteApplicationSettingsRequest::cloudWatchMetricsEnabled))
.setter(setter(Builder::cloudWatchMetricsEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CloudWatchMetricsEnabled").build())
.build();
private static final SdkField EVENT_TAGGING_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("EventTaggingEnabled").getter(getter(WriteApplicationSettingsRequest::eventTaggingEnabled))
.setter(setter(Builder::eventTaggingEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventTaggingEnabled").build())
.build();
private static final SdkField LIMITS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Limits").getter(getter(WriteApplicationSettingsRequest::limits)).setter(setter(Builder::limits))
.constructor(CampaignLimits::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Limits").build()).build();
private static final SdkField QUIET_TIME_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("QuietTime").getter(getter(WriteApplicationSettingsRequest::quietTime))
.setter(setter(Builder::quietTime)).constructor(QuietTime::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QuietTime").build()).build();
private static final SdkField JOURNEY_LIMITS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("JourneyLimits")
.getter(getter(WriteApplicationSettingsRequest::journeyLimits)).setter(setter(Builder::journeyLimits))
.constructor(ApplicationSettingsJourneyLimits::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("JourneyLimits").build()).build();
private static final List> SDK_FIELDS = Collections
.unmodifiableList(Arrays.asList(CAMPAIGN_HOOK_FIELD, CLOUD_WATCH_METRICS_ENABLED_FIELD, EVENT_TAGGING_ENABLED_FIELD,
LIMITS_FIELD, QUIET_TIME_FIELD, JOURNEY_LIMITS_FIELD));
private static final long serialVersionUID = 1L;
private final CampaignHook campaignHook;
private final Boolean cloudWatchMetricsEnabled;
private final Boolean eventTaggingEnabled;
private final CampaignLimits limits;
private final QuietTime quietTime;
private final ApplicationSettingsJourneyLimits journeyLimits;
private WriteApplicationSettingsRequest(BuilderImpl builder) {
this.campaignHook = builder.campaignHook;
this.cloudWatchMetricsEnabled = builder.cloudWatchMetricsEnabled;
this.eventTaggingEnabled = builder.eventTaggingEnabled;
this.limits = builder.limits;
this.quietTime = builder.quietTime;
this.journeyLimits = builder.journeyLimits;
}
/**
*
* The settings for the AWS Lambda function to invoke by default as a code hook for campaigns in the application.
* You can use this hook to customize segments that are used by campaigns in the application.
*
*
* To override these settings and define custom settings for a specific campaign, use the CampaignHook object of the
* Campaign resource.
*
*
* @return The settings for the AWS Lambda function to invoke by default as a code hook for campaigns in the
* application. You can use this hook to customize segments that are used by campaigns in the
* application.
*
* To override these settings and define custom settings for a specific campaign, use the CampaignHook
* object of the Campaign resource.
*/
public final CampaignHook campaignHook() {
return campaignHook;
}
/**
*
* Specifies whether to enable application-related alarms in Amazon CloudWatch.
*
*
* @return Specifies whether to enable application-related alarms in Amazon CloudWatch.
*/
public final Boolean cloudWatchMetricsEnabled() {
return cloudWatchMetricsEnabled;
}
/**
* Returns the value of the EventTaggingEnabled property for this object.
*
* @return The value of the EventTaggingEnabled property for this object.
*/
public final Boolean eventTaggingEnabled() {
return eventTaggingEnabled;
}
/**
*
* The default sending limits for campaigns in the application. To override these limits and define custom limits
* for a specific campaign or journey, use the Campaign resource or the Journey resource, respectively.
*
*
* @return The default sending limits for campaigns in the application. To override these limits and define custom
* limits for a specific campaign or journey, use the Campaign resource or the Journey resource, respectively.
*/
public final CampaignLimits limits() {
return limits;
}
/**
*
* The default quiet time for campaigns in the application. Quiet time is a specific time range when messages aren't
* sent to endpoints, if all the following conditions are met:
*
*
* -
*
* The EndpointDemographic.Timezone property of the endpoint is set to a valid value.
*
*
* -
*
* The current time in the endpoint's time zone is later than or equal to the time specified by the QuietTime.Start
* property for the application (or a campaign or journey that has custom quiet time settings).
*
*
* -
*
* The current time in the endpoint's time zone is earlier than or equal to the time specified by the QuietTime.End
* property for the application (or a campaign or journey that has custom quiet time settings).
*
*
*
*
* If any of the preceding conditions isn't met, the endpoint will receive messages from a campaign or journey, even
* if quiet time is enabled.
*
*
* To override the default quiet time settings for a specific campaign or journey, use the Campaign resource or the Journey resource to define a custom quiet time for the
* campaign or journey.
*
*
* @return The default quiet time for campaigns in the application. Quiet time is a specific time range when
* messages aren't sent to endpoints, if all the following conditions are met:
*
* -
*
* The EndpointDemographic.Timezone property of the endpoint is set to a valid value.
*
*
* -
*
* The current time in the endpoint's time zone is later than or equal to the time specified by the
* QuietTime.Start property for the application (or a campaign or journey that has custom quiet time
* settings).
*
*
* -
*
* The current time in the endpoint's time zone is earlier than or equal to the time specified by the
* QuietTime.End property for the application (or a campaign or journey that has custom quiet time
* settings).
*
*
*
*
* If any of the preceding conditions isn't met, the endpoint will receive messages from a campaign or
* journey, even if quiet time is enabled.
*
*
* To override the default quiet time settings for a specific campaign or journey, use the Campaign resource or the Journey resource to define a custom quiet time
* for the campaign or journey.
*/
public final QuietTime quietTime() {
return quietTime;
}
/**
*
* The default sending limits for journeys in the application. These limits apply to each journey for the
* application but can be overridden, on a per journey basis, with the JourneyLimits resource.
*
*
* @return The default sending limits for journeys in the application. These limits apply to each journey for the
* application but can be overridden, on a per journey basis, with the JourneyLimits resource.
*/
public final ApplicationSettingsJourneyLimits journeyLimits() {
return journeyLimits;
}
@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(campaignHook());
hashCode = 31 * hashCode + Objects.hashCode(cloudWatchMetricsEnabled());
hashCode = 31 * hashCode + Objects.hashCode(eventTaggingEnabled());
hashCode = 31 * hashCode + Objects.hashCode(limits());
hashCode = 31 * hashCode + Objects.hashCode(quietTime());
hashCode = 31 * hashCode + Objects.hashCode(journeyLimits());
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 WriteApplicationSettingsRequest)) {
return false;
}
WriteApplicationSettingsRequest other = (WriteApplicationSettingsRequest) obj;
return Objects.equals(campaignHook(), other.campaignHook())
&& Objects.equals(cloudWatchMetricsEnabled(), other.cloudWatchMetricsEnabled())
&& Objects.equals(eventTaggingEnabled(), other.eventTaggingEnabled()) && Objects.equals(limits(), other.limits())
&& Objects.equals(quietTime(), other.quietTime()) && Objects.equals(journeyLimits(), other.journeyLimits());
}
/**
* 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("WriteApplicationSettingsRequest").add("CampaignHook", campaignHook())
.add("CloudWatchMetricsEnabled", cloudWatchMetricsEnabled()).add("EventTaggingEnabled", eventTaggingEnabled())
.add("Limits", limits()).add("QuietTime", quietTime()).add("JourneyLimits", journeyLimits()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CampaignHook":
return Optional.ofNullable(clazz.cast(campaignHook()));
case "CloudWatchMetricsEnabled":
return Optional.ofNullable(clazz.cast(cloudWatchMetricsEnabled()));
case "EventTaggingEnabled":
return Optional.ofNullable(clazz.cast(eventTaggingEnabled()));
case "Limits":
return Optional.ofNullable(clazz.cast(limits()));
case "QuietTime":
return Optional.ofNullable(clazz.cast(quietTime()));
case "JourneyLimits":
return Optional.ofNullable(clazz.cast(journeyLimits()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function