All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.pinpoint.model.SegmentImportResource Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Pinpoint module holds the client classes that are used for communicating with Amazon Pinpoint Service

There is a newer version: 2.28.4
Show newest version
/*
 * 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.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;

/**
 * 

* Provides information about the import job that created a segment. An import job is a job that creates a user segment * by importing endpoint definitions. *

*/ @Generated("software.amazon.awssdk:codegen") public final class SegmentImportResource implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField> CHANNEL_COUNTS_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("ChannelCounts") .getter(getter(SegmentImportResource::channelCounts)) .setter(setter(Builder::channelCounts)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChannelCounts").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.INTEGER) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final SdkField EXTERNAL_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ExternalId").getter(getter(SegmentImportResource::externalId)).setter(setter(Builder::externalId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExternalId").build()).build(); private static final SdkField FORMAT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Format") .getter(getter(SegmentImportResource::formatAsString)).setter(setter(Builder::format)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Format").build()).build(); private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("RoleArn").getter(getter(SegmentImportResource::roleArn)).setter(setter(Builder::roleArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoleArn").build()).build(); private static final SdkField S3_URL_FIELD = SdkField. builder(MarshallingType.STRING).memberName("S3Url") .getter(getter(SegmentImportResource::s3Url)).setter(setter(Builder::s3Url)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3Url").build()).build(); private static final SdkField SIZE_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Size") .getter(getter(SegmentImportResource::size)).setter(setter(Builder::size)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Size").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CHANNEL_COUNTS_FIELD, EXTERNAL_ID_FIELD, FORMAT_FIELD, ROLE_ARN_FIELD, S3_URL_FIELD, SIZE_FIELD)); private static final long serialVersionUID = 1L; private final Map channelCounts; private final String externalId; private final String format; private final String roleArn; private final String s3Url; private final Integer size; private SegmentImportResource(BuilderImpl builder) { this.channelCounts = builder.channelCounts; this.externalId = builder.externalId; this.format = builder.format; this.roleArn = builder.roleArn; this.s3Url = builder.s3Url; this.size = builder.size; } /** * For responses, this returns true if the service returned a value for the ChannelCounts property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasChannelCounts() { return channelCounts != null && !(channelCounts instanceof SdkAutoConstructMap); } /** *

* The number of channel types in the endpoint definitions that were imported to create the segment. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasChannelCounts} method. *

* * @return The number of channel types in the endpoint definitions that were imported to create the segment. */ public final Map channelCounts() { return channelCounts; } /** *

* (Deprecated) Your AWS account ID, which you assigned to an external ID key in an IAM trust policy. Amazon * Pinpoint previously used this value to assume an IAM role when importing endpoint definitions, but we removed * this requirement. We don't recommend use of external IDs for IAM roles that are assumed by Amazon Pinpoint. *

* * @return (Deprecated) Your AWS account ID, which you assigned to an external ID key in an IAM trust policy. Amazon * Pinpoint previously used this value to assume an IAM role when importing endpoint definitions, but we * removed this requirement. We don't recommend use of external IDs for IAM roles that are assumed by Amazon * Pinpoint. */ public final String externalId() { return externalId; } /** *

* The format of the files that were imported to create the segment. Valid values are: CSV, for comma-separated * values format; and, JSON, for newline-delimited JSON format. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #format} will * return {@link Format#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #formatAsString}. *

* * @return The format of the files that were imported to create the segment. Valid values are: CSV, for * comma-separated values format; and, JSON, for newline-delimited JSON format. * @see Format */ public final Format format() { return Format.fromValue(format); } /** *

* The format of the files that were imported to create the segment. Valid values are: CSV, for comma-separated * values format; and, JSON, for newline-delimited JSON format. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #format} will * return {@link Format#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #formatAsString}. *

* * @return The format of the files that were imported to create the segment. Valid values are: CSV, for * comma-separated values format; and, JSON, for newline-delimited JSON format. * @see Format */ public final String formatAsString() { return format; } /** *

* The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that authorized Amazon * Pinpoint to access the Amazon S3 location to import endpoint definitions from. *

* * @return The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that authorized * Amazon Pinpoint to access the Amazon S3 location to import endpoint definitions from. */ public final String roleArn() { return roleArn; } /** *

* The URL of the Amazon Simple Storage Service (Amazon S3) bucket that the endpoint definitions were imported from * to create the segment. *

* * @return The URL of the Amazon Simple Storage Service (Amazon S3) bucket that the endpoint definitions were * imported from to create the segment. */ public final String s3Url() { return s3Url; } /** *

* The number of endpoint definitions that were imported successfully to create the segment. *

* * @return The number of endpoint definitions that were imported successfully to create the segment. */ public final Integer size() { return size; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(hasChannelCounts() ? channelCounts() : null); hashCode = 31 * hashCode + Objects.hashCode(externalId()); hashCode = 31 * hashCode + Objects.hashCode(formatAsString()); hashCode = 31 * hashCode + Objects.hashCode(roleArn()); hashCode = 31 * hashCode + Objects.hashCode(s3Url()); hashCode = 31 * hashCode + Objects.hashCode(size()); 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 SegmentImportResource)) { return false; } SegmentImportResource other = (SegmentImportResource) obj; return hasChannelCounts() == other.hasChannelCounts() && Objects.equals(channelCounts(), other.channelCounts()) && Objects.equals(externalId(), other.externalId()) && Objects.equals(formatAsString(), other.formatAsString()) && Objects.equals(roleArn(), other.roleArn()) && Objects.equals(s3Url(), other.s3Url()) && Objects.equals(size(), other.size()); } /** * 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("SegmentImportResource").add("ChannelCounts", hasChannelCounts() ? channelCounts() : null) .add("ExternalId", externalId()).add("Format", formatAsString()).add("RoleArn", roleArn()).add("S3Url", s3Url()) .add("Size", size()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ChannelCounts": return Optional.ofNullable(clazz.cast(channelCounts())); case "ExternalId": return Optional.ofNullable(clazz.cast(externalId())); case "Format": return Optional.ofNullable(clazz.cast(formatAsString())); case "RoleArn": return Optional.ofNullable(clazz.cast(roleArn())); case "S3Url": return Optional.ofNullable(clazz.cast(s3Url())); case "Size": return Optional.ofNullable(clazz.cast(size())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((SegmentImportResource) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The number of channel types in the endpoint definitions that were imported to create the segment. *

* * @param channelCounts * The number of channel types in the endpoint definitions that were imported to create the segment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder channelCounts(Map channelCounts); /** *

* (Deprecated) Your AWS account ID, which you assigned to an external ID key in an IAM trust policy. Amazon * Pinpoint previously used this value to assume an IAM role when importing endpoint definitions, but we removed * this requirement. We don't recommend use of external IDs for IAM roles that are assumed by Amazon Pinpoint. *

* * @param externalId * (Deprecated) Your AWS account ID, which you assigned to an external ID key in an IAM trust policy. * Amazon Pinpoint previously used this value to assume an IAM role when importing endpoint definitions, * but we removed this requirement. We don't recommend use of external IDs for IAM roles that are assumed * by Amazon Pinpoint. * @return Returns a reference to this object so that method calls can be chained together. */ Builder externalId(String externalId); /** *

* The format of the files that were imported to create the segment. Valid values are: CSV, for comma-separated * values format; and, JSON, for newline-delimited JSON format. *

* * @param format * The format of the files that were imported to create the segment. Valid values are: CSV, for * comma-separated values format; and, JSON, for newline-delimited JSON format. * @see Format * @return Returns a reference to this object so that method calls can be chained together. * @see Format */ Builder format(String format); /** *

* The format of the files that were imported to create the segment. Valid values are: CSV, for comma-separated * values format; and, JSON, for newline-delimited JSON format. *

* * @param format * The format of the files that were imported to create the segment. Valid values are: CSV, for * comma-separated values format; and, JSON, for newline-delimited JSON format. * @see Format * @return Returns a reference to this object so that method calls can be chained together. * @see Format */ Builder format(Format format); /** *

* The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that authorized Amazon * Pinpoint to access the Amazon S3 location to import endpoint definitions from. *

* * @param roleArn * The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that authorized * Amazon Pinpoint to access the Amazon S3 location to import endpoint definitions from. * @return Returns a reference to this object so that method calls can be chained together. */ Builder roleArn(String roleArn); /** *

* The URL of the Amazon Simple Storage Service (Amazon S3) bucket that the endpoint definitions were imported * from to create the segment. *

* * @param s3Url * The URL of the Amazon Simple Storage Service (Amazon S3) bucket that the endpoint definitions were * imported from to create the segment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder s3Url(String s3Url); /** *

* The number of endpoint definitions that were imported successfully to create the segment. *

* * @param size * The number of endpoint definitions that were imported successfully to create the segment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder size(Integer size); } static final class BuilderImpl implements Builder { private Map channelCounts = DefaultSdkAutoConstructMap.getInstance(); private String externalId; private String format; private String roleArn; private String s3Url; private Integer size; private BuilderImpl() { } private BuilderImpl(SegmentImportResource model) { channelCounts(model.channelCounts); externalId(model.externalId); format(model.format); roleArn(model.roleArn); s3Url(model.s3Url); size(model.size); } public final Map getChannelCounts() { if (channelCounts instanceof SdkAutoConstructMap) { return null; } return channelCounts; } public final void setChannelCounts(Map channelCounts) { this.channelCounts = MapOf__integerCopier.copy(channelCounts); } @Override public final Builder channelCounts(Map channelCounts) { this.channelCounts = MapOf__integerCopier.copy(channelCounts); return this; } public final String getExternalId() { return externalId; } public final void setExternalId(String externalId) { this.externalId = externalId; } @Override public final Builder externalId(String externalId) { this.externalId = externalId; return this; } public final String getFormat() { return format; } public final void setFormat(String format) { this.format = format; } @Override public final Builder format(String format) { this.format = format; return this; } @Override public final Builder format(Format format) { this.format(format == null ? null : format.toString()); return this; } public final String getRoleArn() { return roleArn; } public final void setRoleArn(String roleArn) { this.roleArn = roleArn; } @Override public final Builder roleArn(String roleArn) { this.roleArn = roleArn; return this; } public final String getS3Url() { return s3Url; } public final void setS3Url(String s3Url) { this.s3Url = s3Url; } @Override public final Builder s3Url(String s3Url) { this.s3Url = s3Url; return this; } public final Integer getSize() { return size; } public final void setSize(Integer size) { this.size = size; } @Override public final Builder size(Integer size) { this.size = size; return this; } @Override public SegmentImportResource build() { return new SegmentImportResource(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy