software.amazon.awssdk.services.pinpoint.model.ApplicationSettingsResource 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;
/**
*
* Provides information about an application, including the default settings for an application.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ApplicationSettingsResource implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField APPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ApplicationId").getter(getter(ApplicationSettingsResource::applicationId))
.setter(setter(Builder::applicationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplicationId").build()).build();
private static final SdkField CAMPAIGN_HOOK_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("CampaignHook").getter(getter(ApplicationSettingsResource::campaignHook))
.setter(setter(Builder::campaignHook)).constructor(CampaignHook::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CampaignHook").build()).build();
private static final SdkField LAST_MODIFIED_DATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LastModifiedDate").getter(getter(ApplicationSettingsResource::lastModifiedDate))
.setter(setter(Builder::lastModifiedDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedDate").build()).build();
private static final SdkField LIMITS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Limits").getter(getter(ApplicationSettingsResource::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(ApplicationSettingsResource::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(ApplicationSettingsResource::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(APPLICATION_ID_FIELD,
CAMPAIGN_HOOK_FIELD, LAST_MODIFIED_DATE_FIELD, LIMITS_FIELD, QUIET_TIME_FIELD, JOURNEY_LIMITS_FIELD));
private static final long serialVersionUID = 1L;
private final String applicationId;
private final CampaignHook campaignHook;
private final String lastModifiedDate;
private final CampaignLimits limits;
private final QuietTime quietTime;
private final ApplicationSettingsJourneyLimits journeyLimits;
private ApplicationSettingsResource(BuilderImpl builder) {
this.applicationId = builder.applicationId;
this.campaignHook = builder.campaignHook;
this.lastModifiedDate = builder.lastModifiedDate;
this.limits = builder.limits;
this.quietTime = builder.quietTime;
this.journeyLimits = builder.journeyLimits;
}
/**
*
* The unique identifier for the application. This identifier is displayed as the Project ID on the Amazon
* Pinpoint console.
*
*
* @return The unique identifier for the application. This identifier is displayed as the Project ID on the
* Amazon Pinpoint console.
*/
public final String applicationId() {
return applicationId;
}
/**
*
* 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.
*
*
* @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.
*/
public final CampaignHook campaignHook() {
return campaignHook;
}
/**
*
* The date and time, in ISO 8601 format, when the application's settings were last modified.
*
*
* @return The date and time, in ISO 8601 format, when the application's settings were last modified.
*/
public final String lastModifiedDate() {
return lastModifiedDate;
}
/**
*
* The default sending limits for campaigns in the application.
*
*
* @return The default sending limits for campaigns in the application.
*/
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.
*
*
* @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.
*/
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(applicationId());
hashCode = 31 * hashCode + Objects.hashCode(campaignHook());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedDate());
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 ApplicationSettingsResource)) {
return false;
}
ApplicationSettingsResource other = (ApplicationSettingsResource) obj;
return Objects.equals(applicationId(), other.applicationId()) && Objects.equals(campaignHook(), other.campaignHook())
&& Objects.equals(lastModifiedDate(), other.lastModifiedDate()) && 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("ApplicationSettingsResource").add("ApplicationId", applicationId())
.add("CampaignHook", campaignHook()).add("LastModifiedDate", lastModifiedDate()).add("Limits", limits())
.add("QuietTime", quietTime()).add("JourneyLimits", journeyLimits()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ApplicationId":
return Optional.ofNullable(clazz.cast(applicationId()));
case "CampaignHook":
return Optional.ofNullable(clazz.cast(campaignHook()));
case "LastModifiedDate":
return Optional.ofNullable(clazz.cast(lastModifiedDate()));
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