software.amazon.awssdk.services.pinpointemail.model.CloudWatchDimensionConfiguration Maven / Gradle / Ivy
Show all versions of pinpointemail 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.pinpointemail.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.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;
/**
*
* An object that defines the dimension configuration to use when you send Amazon Pinpoint email events to Amazon
* CloudWatch.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CloudWatchDimensionConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DIMENSION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DimensionName").getter(getter(CloudWatchDimensionConfiguration::dimensionName))
.setter(setter(Builder::dimensionName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DimensionName").build()).build();
private static final SdkField DIMENSION_VALUE_SOURCE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DimensionValueSource").getter(getter(CloudWatchDimensionConfiguration::dimensionValueSourceAsString))
.setter(setter(Builder::dimensionValueSource))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DimensionValueSource").build())
.build();
private static final SdkField DEFAULT_DIMENSION_VALUE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DefaultDimensionValue").getter(getter(CloudWatchDimensionConfiguration::defaultDimensionValue))
.setter(setter(Builder::defaultDimensionValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefaultDimensionValue").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DIMENSION_NAME_FIELD,
DIMENSION_VALUE_SOURCE_FIELD, DEFAULT_DIMENSION_VALUE_FIELD));
private static final long serialVersionUID = 1L;
private final String dimensionName;
private final String dimensionValueSource;
private final String defaultDimensionValue;
private CloudWatchDimensionConfiguration(BuilderImpl builder) {
this.dimensionName = builder.dimensionName;
this.dimensionValueSource = builder.dimensionValueSource;
this.defaultDimensionValue = builder.defaultDimensionValue;
}
/**
*
* The name of an Amazon CloudWatch dimension associated with an email sending metric. The name has to meet the
* following criteria:
*
*
* -
*
* It can only contain ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).
*
*
* -
*
* It can contain no more than 256 characters.
*
*
*
*
* @return The name of an Amazon CloudWatch dimension associated with an email sending metric. The name has to meet
* the following criteria:
*
* -
*
* It can only contain ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).
*
*
* -
*
* It can contain no more than 256 characters.
*
*
*/
public final String dimensionName() {
return dimensionName;
}
/**
*
* The location where Amazon Pinpoint finds the value of a dimension to publish to Amazon CloudWatch. If you want
* Amazon Pinpoint to use the message tags that you specify using an X-SES-MESSAGE-TAGS header or a parameter to the
* SendEmail/SendRawEmail API, choose messageTag
. If you want Amazon Pinpoint to use your own email
* headers, choose emailHeader
. If you want Amazon Pinpoint to use link tags, choose
* linkTags
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dimensionValueSource} will return {@link DimensionValueSource#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #dimensionValueSourceAsString}.
*
*
* @return The location where Amazon Pinpoint finds the value of a dimension to publish to Amazon CloudWatch. If you
* want Amazon Pinpoint to use the message tags that you specify using an X-SES-MESSAGE-TAGS header or a
* parameter to the SendEmail/SendRawEmail API, choose messageTag
. If you want Amazon Pinpoint
* to use your own email headers, choose emailHeader
. If you want Amazon Pinpoint to use link
* tags, choose linkTags
.
* @see DimensionValueSource
*/
public final DimensionValueSource dimensionValueSource() {
return DimensionValueSource.fromValue(dimensionValueSource);
}
/**
*
* The location where Amazon Pinpoint finds the value of a dimension to publish to Amazon CloudWatch. If you want
* Amazon Pinpoint to use the message tags that you specify using an X-SES-MESSAGE-TAGS header or a parameter to the
* SendEmail/SendRawEmail API, choose messageTag
. If you want Amazon Pinpoint to use your own email
* headers, choose emailHeader
. If you want Amazon Pinpoint to use link tags, choose
* linkTags
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dimensionValueSource} will return {@link DimensionValueSource#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #dimensionValueSourceAsString}.
*
*
* @return The location where Amazon Pinpoint finds the value of a dimension to publish to Amazon CloudWatch. If you
* want Amazon Pinpoint to use the message tags that you specify using an X-SES-MESSAGE-TAGS header or a
* parameter to the SendEmail/SendRawEmail API, choose messageTag
. If you want Amazon Pinpoint
* to use your own email headers, choose emailHeader
. If you want Amazon Pinpoint to use link
* tags, choose linkTags
.
* @see DimensionValueSource
*/
public final String dimensionValueSourceAsString() {
return dimensionValueSource;
}
/**
*
* The default value of the dimension that is published to Amazon CloudWatch if you don't provide the value of the
* dimension when you send an email. This value has to meet the following criteria:
*
*
* -
*
* It can only contain ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).
*
*
* -
*
* It can contain no more than 256 characters.
*
*
*
*
* @return The default value of the dimension that is published to Amazon CloudWatch if you don't provide the value
* of the dimension when you send an email. This value has to meet the following criteria:
*
* -
*
* It can only contain ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).
*
*
* -
*
* It can contain no more than 256 characters.
*
*
*/
public final String defaultDimensionValue() {
return defaultDimensionValue;
}
@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(dimensionName());
hashCode = 31 * hashCode + Objects.hashCode(dimensionValueSourceAsString());
hashCode = 31 * hashCode + Objects.hashCode(defaultDimensionValue());
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 CloudWatchDimensionConfiguration)) {
return false;
}
CloudWatchDimensionConfiguration other = (CloudWatchDimensionConfiguration) obj;
return Objects.equals(dimensionName(), other.dimensionName())
&& Objects.equals(dimensionValueSourceAsString(), other.dimensionValueSourceAsString())
&& Objects.equals(defaultDimensionValue(), other.defaultDimensionValue());
}
/**
* 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("CloudWatchDimensionConfiguration").add("DimensionName", dimensionName())
.add("DimensionValueSource", dimensionValueSourceAsString())
.add("DefaultDimensionValue", defaultDimensionValue()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DimensionName":
return Optional.ofNullable(clazz.cast(dimensionName()));
case "DimensionValueSource":
return Optional.ofNullable(clazz.cast(dimensionValueSourceAsString()));
case "DefaultDimensionValue":
return Optional.ofNullable(clazz.cast(defaultDimensionValue()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function