
software.amazon.awssdk.services.quicksight.model.CreateTemplateRequest Maven / Gradle / Ivy
/*
* 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.quicksight.model;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateTemplateRequest extends QuickSightRequest implements
ToCopyableBuilder {
private static final SdkField AWS_ACCOUNT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AwsAccountId").getter(getter(CreateTemplateRequest::awsAccountId)).setter(setter(Builder::awsAccountId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("AwsAccountId").build()).build();
private static final SdkField TEMPLATE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TemplateId").getter(getter(CreateTemplateRequest::templateId)).setter(setter(Builder::templateId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("TemplateId").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(CreateTemplateRequest::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField> PERMISSIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Permissions")
.getter(getter(CreateTemplateRequest::permissions))
.setter(setter(Builder::permissions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Permissions").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ResourcePermission::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField SOURCE_ENTITY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("SourceEntity")
.getter(getter(CreateTemplateRequest::sourceEntity)).setter(setter(Builder::sourceEntity))
.constructor(TemplateSourceEntity::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceEntity").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(CreateTemplateRequest::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField VERSION_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("VersionDescription").getter(getter(CreateTemplateRequest::versionDescription))
.setter(setter(Builder::versionDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VersionDescription").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AWS_ACCOUNT_ID_FIELD,
TEMPLATE_ID_FIELD, NAME_FIELD, PERMISSIONS_FIELD, SOURCE_ENTITY_FIELD, TAGS_FIELD, VERSION_DESCRIPTION_FIELD));
private final String awsAccountId;
private final String templateId;
private final String name;
private final List permissions;
private final TemplateSourceEntity sourceEntity;
private final List tags;
private final String versionDescription;
private CreateTemplateRequest(BuilderImpl builder) {
super(builder);
this.awsAccountId = builder.awsAccountId;
this.templateId = builder.templateId;
this.name = builder.name;
this.permissions = builder.permissions;
this.sourceEntity = builder.sourceEntity;
this.tags = builder.tags;
this.versionDescription = builder.versionDescription;
}
/**
*
* The ID for the AWS account that the group is in. Currently, you use the ID for the AWS account that contains your
* Amazon QuickSight account.
*
*
* @return The ID for the AWS account that the group is in. Currently, you use the ID for the AWS account that
* contains your Amazon QuickSight account.
*/
public final String awsAccountId() {
return awsAccountId;
}
/**
*
* An ID for the template that you want to create. This template is unique per AWS Region in each AWS account.
*
*
* @return An ID for the template that you want to create. This template is unique per AWS Region in each AWS
* account.
*/
public final String templateId() {
return templateId;
}
/**
*
* A display name for the template.
*
*
* @return A display name for the template.
*/
public final String name() {
return name;
}
/**
* Returns true if the Permissions property was specified by the sender (it may be empty), or false if the sender
* did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public final boolean hasPermissions() {
return permissions != null && !(permissions instanceof SdkAutoConstructList);
}
/**
*
* A list of resource permissions to be set on the template.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasPermissions()} to see if a value was sent in this field.
*
*
* @return A list of resource permissions to be set on the template.
*/
public final List permissions() {
return permissions;
}
/**
*
* The entity that you are using as a source when you create the template. In SourceEntity
, you specify
* the type of object you're using as source: SourceTemplate
for a template or
* SourceAnalysis
for an analysis. Both of these require an Amazon Resource Name (ARN). For
* SourceTemplate
, specify the ARN of the source template. For SourceAnalysis
, specify the
* ARN of the source analysis. The SourceTemplate
ARN can contain any AWS Account and any
* QuickSight-supported AWS Region.
*
*
* Use the DataSetReferences
entity within SourceTemplate
or SourceAnalysis
* to list the replacement datasets for the placeholders listed in the original. The schema in each dataset must
* match its placeholder.
*
*
* @return The entity that you are using as a source when you create the template. In SourceEntity
, you
* specify the type of object you're using as source: SourceTemplate
for a template or
* SourceAnalysis
for an analysis. Both of these require an Amazon Resource Name (ARN). For
* SourceTemplate
, specify the ARN of the source template. For SourceAnalysis
,
* specify the ARN of the source analysis. The SourceTemplate
ARN can contain any AWS Account
* and any QuickSight-supported AWS Region.
*
* Use the DataSetReferences
entity within SourceTemplate
or
* SourceAnalysis
to list the replacement datasets for the placeholders listed in the original.
* The schema in each dataset must match its placeholder.
*/
public final TemplateSourceEntity sourceEntity() {
return sourceEntity;
}
/**
* Returns true if the Tags property was specified by the sender (it may be empty), or false if the sender did not
* specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* Contains a map of the key-value pairs for the resource tag or tags assigned to the resource.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasTags()} to see if a value was sent in this field.
*
*
* @return Contains a map of the key-value pairs for the resource tag or tags assigned to the resource.
*/
public final List tags() {
return tags;
}
/**
*
* A description of the current template version being created. This API operation creates the first version of the
* template. Every time UpdateTemplate
is called, a new version is created. Each version of the
* template maintains a description of the version in the VersionDescription
field.
*
*
* @return A description of the current template version being created. This API operation creates the first version
* of the template. Every time UpdateTemplate
is called, a new version is created. Each version
* of the template maintains a description of the version in the VersionDescription
field.
*/
public final String versionDescription() {
return versionDescription;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(awsAccountId());
hashCode = 31 * hashCode + Objects.hashCode(templateId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(hasPermissions() ? permissions() : null);
hashCode = 31 * hashCode + Objects.hashCode(sourceEntity());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(versionDescription());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateTemplateRequest)) {
return false;
}
CreateTemplateRequest other = (CreateTemplateRequest) obj;
return Objects.equals(awsAccountId(), other.awsAccountId()) && Objects.equals(templateId(), other.templateId())
&& Objects.equals(name(), other.name()) && hasPermissions() == other.hasPermissions()
&& Objects.equals(permissions(), other.permissions()) && Objects.equals(sourceEntity(), other.sourceEntity())
&& hasTags() == other.hasTags() && Objects.equals(tags(), other.tags())
&& Objects.equals(versionDescription(), other.versionDescription());
}
/**
* 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("CreateTemplateRequest").add("AwsAccountId", awsAccountId()).add("TemplateId", templateId())
.add("Name", name()).add("Permissions", hasPermissions() ? permissions() : null)
.add("SourceEntity", sourceEntity()).add("Tags", hasTags() ? tags() : null)
.add("VersionDescription", versionDescription()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AwsAccountId":
return Optional.ofNullable(clazz.cast(awsAccountId()));
case "TemplateId":
return Optional.ofNullable(clazz.cast(templateId()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Permissions":
return Optional.ofNullable(clazz.cast(permissions()));
case "SourceEntity":
return Optional.ofNullable(clazz.cast(sourceEntity()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
case "VersionDescription":
return Optional.ofNullable(clazz.cast(versionDescription()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function