software.amazon.awssdk.services.pinpoint.model.ImportJobResource 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.HashMap;
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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Provides information about the resource settings for a job that imports endpoint definitions from one or more files.
* The files can be stored in an Amazon Simple Storage Service (Amazon S3) bucket or uploaded directly from a computer
* by using the Amazon Pinpoint console.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ImportJobResource implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DEFINE_SEGMENT_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("DefineSegment").getter(getter(ImportJobResource::defineSegment)).setter(setter(Builder::defineSegment))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefineSegment").build()).build();
private static final SdkField EXTERNAL_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ExternalId").getter(getter(ImportJobResource::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(ImportJobResource::formatAsString)).setter(setter(Builder::format))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Format").build()).build();
private static final SdkField REGISTER_ENDPOINTS_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("RegisterEndpoints").getter(getter(ImportJobResource::registerEndpoints))
.setter(setter(Builder::registerEndpoints))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RegisterEndpoints").build()).build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RoleArn").getter(getter(ImportJobResource::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(ImportJobResource::s3Url)).setter(setter(Builder::s3Url))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3Url").build()).build();
private static final SdkField SEGMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SegmentId").getter(getter(ImportJobResource::segmentId)).setter(setter(Builder::segmentId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SegmentId").build()).build();
private static final SdkField SEGMENT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SegmentName").getter(getter(ImportJobResource::segmentName)).setter(setter(Builder::segmentName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SegmentName").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DEFINE_SEGMENT_FIELD,
EXTERNAL_ID_FIELD, FORMAT_FIELD, REGISTER_ENDPOINTS_FIELD, ROLE_ARN_FIELD, S3_URL_FIELD, SEGMENT_ID_FIELD,
SEGMENT_NAME_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("DefineSegment", DEFINE_SEGMENT_FIELD);
put("ExternalId", EXTERNAL_ID_FIELD);
put("Format", FORMAT_FIELD);
put("RegisterEndpoints", REGISTER_ENDPOINTS_FIELD);
put("RoleArn", ROLE_ARN_FIELD);
put("S3Url", S3_URL_FIELD);
put("SegmentId", SEGMENT_ID_FIELD);
put("SegmentName", SEGMENT_NAME_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final Boolean defineSegment;
private final String externalId;
private final String format;
private final Boolean registerEndpoints;
private final String roleArn;
private final String s3Url;
private final String segmentId;
private final String segmentName;
private ImportJobResource(BuilderImpl builder) {
this.defineSegment = builder.defineSegment;
this.externalId = builder.externalId;
this.format = builder.format;
this.registerEndpoints = builder.registerEndpoints;
this.roleArn = builder.roleArn;
this.s3Url = builder.s3Url;
this.segmentId = builder.segmentId;
this.segmentName = builder.segmentName;
}
/**
*
* Specifies whether the import job creates a segment that contains the endpoints, when the endpoint definitions are
* imported.
*
*
* @return Specifies whether the import job creates a segment that contains the endpoints, when the endpoint
* definitions are imported.
*/
public final Boolean defineSegment() {
return defineSegment;
}
/**
*
* (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 contain the endpoint definitions to import. Valid values are: CSV, for
* comma-separated values format; and, JSON, for newline-delimited JSON format.
*
*
* If the files are stored in an Amazon S3 location and that location contains multiple files that use different
* formats, Amazon Pinpoint imports data only from the files that use the specified 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 contain the endpoint definitions to import. Valid values are: CSV, for
* comma-separated values format; and, JSON, for newline-delimited JSON format.
*
* If the files are stored in an Amazon S3 location and that location contains multiple files that use
* different formats, Amazon Pinpoint imports data only from the files that use the specified format.
* @see Format
*/
public final Format format() {
return Format.fromValue(format);
}
/**
*
* The format of the files that contain the endpoint definitions to import. Valid values are: CSV, for
* comma-separated values format; and, JSON, for newline-delimited JSON format.
*
*
* If the files are stored in an Amazon S3 location and that location contains multiple files that use different
* formats, Amazon Pinpoint imports data only from the files that use the specified 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 contain the endpoint definitions to import. Valid values are: CSV, for
* comma-separated values format; and, JSON, for newline-delimited JSON format.
*
* If the files are stored in an Amazon S3 location and that location contains multiple files that use
* different formats, Amazon Pinpoint imports data only from the files that use the specified format.
* @see Format
*/
public final String formatAsString() {
return format;
}
/**
*
* Specifies whether the import job registers the endpoints with Amazon Pinpoint, when the endpoint definitions are
* imported.
*
*
* @return Specifies whether the import job registers the endpoints with Amazon Pinpoint, when the endpoint
* definitions are imported.
*/
public final Boolean registerEndpoints() {
return registerEndpoints;
}
/**
*
* The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that authorizes 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 authorizes
* 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 contains the endpoint definitions to import.
* This location can be a folder or a single file. If the location is a folder, Amazon Pinpoint imports endpoint
* definitions from the files in this location, including any subfolders that the folder contains.
*
*
* The URL should be in the following format:
* s3://bucket-name /folder-name /file-name . The location can end with the key for an individual object or a prefix
* that qualifies multiple objects.
*
*
* @return The URL of the Amazon Simple Storage Service (Amazon S3) bucket that contains the endpoint definitions to
* import. This location can be a folder or a single file. If the location is a folder, Amazon Pinpoint
* imports endpoint definitions from the files in this location, including any subfolders that the folder
* contains.
*
* The URL should be in the following format:
* s3://bucket-name /folder
* -name /file-name . The location can end with the key for an
* individual object or a prefix that qualifies multiple objects.
*/
public final String s3Url() {
return s3Url;
}
/**
*
* The identifier for the segment that the import job updates or adds endpoint definitions to, if the import job
* updates an existing segment.
*
*
* @return The identifier for the segment that the import job updates or adds endpoint definitions to, if the import
* job updates an existing segment.
*/
public final String segmentId() {
return segmentId;
}
/**
*
* The custom name for the segment that's created by the import job, if the value of the DefineSegment property is
* true.
*
*
* @return The custom name for the segment that's created by the import job, if the value of the DefineSegment
* property is true.
*/
public final String segmentName() {
return segmentName;
}
@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(defineSegment());
hashCode = 31 * hashCode + Objects.hashCode(externalId());
hashCode = 31 * hashCode + Objects.hashCode(formatAsString());
hashCode = 31 * hashCode + Objects.hashCode(registerEndpoints());
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(s3Url());
hashCode = 31 * hashCode + Objects.hashCode(segmentId());
hashCode = 31 * hashCode + Objects.hashCode(segmentName());
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 ImportJobResource)) {
return false;
}
ImportJobResource other = (ImportJobResource) obj;
return Objects.equals(defineSegment(), other.defineSegment()) && Objects.equals(externalId(), other.externalId())
&& Objects.equals(formatAsString(), other.formatAsString())
&& Objects.equals(registerEndpoints(), other.registerEndpoints()) && Objects.equals(roleArn(), other.roleArn())
&& Objects.equals(s3Url(), other.s3Url()) && Objects.equals(segmentId(), other.segmentId())
&& Objects.equals(segmentName(), other.segmentName());
}
/**
* 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("ImportJobResource").add("DefineSegment", defineSegment()).add("ExternalId", externalId())
.add("Format", formatAsString()).add("RegisterEndpoints", registerEndpoints()).add("RoleArn", roleArn())
.add("S3Url", s3Url()).add("SegmentId", segmentId()).add("SegmentName", segmentName()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DefineSegment":
return Optional.ofNullable(clazz.cast(defineSegment()));
case "ExternalId":
return Optional.ofNullable(clazz.cast(externalId()));
case "Format":
return Optional.ofNullable(clazz.cast(formatAsString()));
case "RegisterEndpoints":
return Optional.ofNullable(clazz.cast(registerEndpoints()));
case "RoleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "S3Url":
return Optional.ofNullable(clazz.cast(s3Url()));
case "SegmentId":
return Optional.ofNullable(clazz.cast(segmentId()));
case "SegmentName":
return Optional.ofNullable(clazz.cast(segmentName()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function