
software.amazon.awssdk.services.quicksight.model.CreateAnalysisRequest 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 CreateAnalysisRequest extends QuickSightRequest implements
ToCopyableBuilder {
private static final SdkField AWS_ACCOUNT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AwsAccountId").getter(getter(CreateAnalysisRequest::awsAccountId)).setter(setter(Builder::awsAccountId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("AwsAccountId").build()).build();
private static final SdkField ANALYSIS_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AnalysisId").getter(getter(CreateAnalysisRequest::analysisId)).setter(setter(Builder::analysisId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("AnalysisId").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(CreateAnalysisRequest::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField PARAMETERS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Parameters").getter(getter(CreateAnalysisRequest::parameters)).setter(setter(Builder::parameters))
.constructor(Parameters::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Parameters").build()).build();
private static final SdkField> PERMISSIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Permissions")
.getter(getter(CreateAnalysisRequest::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(CreateAnalysisRequest::sourceEntity)).setter(setter(Builder::sourceEntity))
.constructor(AnalysisSourceEntity::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceEntity").build()).build();
private static final SdkField THEME_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ThemeArn").getter(getter(CreateAnalysisRequest::themeArn)).setter(setter(Builder::themeArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ThemeArn").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(CreateAnalysisRequest::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 List> SDK_FIELDS = Collections
.unmodifiableList(Arrays.asList(AWS_ACCOUNT_ID_FIELD, ANALYSIS_ID_FIELD, NAME_FIELD, PARAMETERS_FIELD,
PERMISSIONS_FIELD, SOURCE_ENTITY_FIELD, THEME_ARN_FIELD, TAGS_FIELD));
private final String awsAccountId;
private final String analysisId;
private final String name;
private final Parameters parameters;
private final List permissions;
private final AnalysisSourceEntity sourceEntity;
private final String themeArn;
private final List tags;
private CreateAnalysisRequest(BuilderImpl builder) {
super(builder);
this.awsAccountId = builder.awsAccountId;
this.analysisId = builder.analysisId;
this.name = builder.name;
this.parameters = builder.parameters;
this.permissions = builder.permissions;
this.sourceEntity = builder.sourceEntity;
this.themeArn = builder.themeArn;
this.tags = builder.tags;
}
/**
*
* The ID of the AWS account where you are creating an analysis.
*
*
* @return The ID of the AWS account where you are creating an analysis.
*/
public String awsAccountId() {
return awsAccountId;
}
/**
*
* The ID for the analysis that you're creating. This ID displays in the URL of the analysis.
*
*
* @return The ID for the analysis that you're creating. This ID displays in the URL of the analysis.
*/
public String analysisId() {
return analysisId;
}
/**
*
* A descriptive name for the analysis that you're creating. This name displays for the analysis in the QuickSight
* console.
*
*
* @return A descriptive name for the analysis that you're creating. This name displays for the analysis in the
* QuickSight console.
*/
public String name() {
return name;
}
/**
*
* The parameter names and override values that you want to use. An analysis can have any parameter type, and some
* parameters might accept multiple values.
*
*
* @return The parameter names and override values that you want to use. An analysis can have any parameter type,
* and some parameters might accept multiple values.
*/
public Parameters parameters() {
return parameters;
}
/**
* 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 boolean hasPermissions() {
return permissions != null && !(permissions instanceof SdkAutoConstructList);
}
/**
*
* A structure that describes the principals and the resource-level permissions on an analysis. You can use the
* Permissions
structure to grant permissions by providing a list of AWS Identity and Access Management
* (IAM) action information for each principal listed by Amazon Resource Name (ARN).
*
*
* To specify no permissions, omit Permissions
.
*
*
* 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 structure that describes the principals and the resource-level permissions on an analysis. You can use
* the Permissions
structure to grant permissions by providing a list of AWS Identity and
* Access Management (IAM) action information for each principal listed by Amazon Resource Name (ARN).
*
* To specify no permissions, omit Permissions
.
*/
public List permissions() {
return permissions;
}
/**
*
* A source entity to use for the analysis that you're creating. This metadata structure contains details that
* describe a source template and one or more datasets.
*
*
* @return A source entity to use for the analysis that you're creating. This metadata structure contains details
* that describe a source template and one or more datasets.
*/
public AnalysisSourceEntity sourceEntity() {
return sourceEntity;
}
/**
*
* The ARN for the theme to apply to the analysis that you're creating. To see the theme in the QuickSight console,
* make sure that you have access to it.
*
*
* @return The ARN for the theme to apply to the analysis that you're creating. To see the theme in the QuickSight
* console, make sure that you have access to it.
*/
public String themeArn() {
return themeArn;
}
/**
* 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 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 analysis.
*
*
* 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 analysis.
*/
public List tags() {
return tags;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(awsAccountId());
hashCode = 31 * hashCode + Objects.hashCode(analysisId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(parameters());
hashCode = 31 * hashCode + Objects.hashCode(hasPermissions() ? permissions() : null);
hashCode = 31 * hashCode + Objects.hashCode(sourceEntity());
hashCode = 31 * hashCode + Objects.hashCode(themeArn());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateAnalysisRequest)) {
return false;
}
CreateAnalysisRequest other = (CreateAnalysisRequest) obj;
return Objects.equals(awsAccountId(), other.awsAccountId()) && Objects.equals(analysisId(), other.analysisId())
&& Objects.equals(name(), other.name()) && Objects.equals(parameters(), other.parameters())
&& hasPermissions() == other.hasPermissions() && Objects.equals(permissions(), other.permissions())
&& Objects.equals(sourceEntity(), other.sourceEntity()) && Objects.equals(themeArn(), other.themeArn())
&& hasTags() == other.hasTags() && Objects.equals(tags(), other.tags());
}
/**
* 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 String toString() {
return ToString.builder("CreateAnalysisRequest").add("AwsAccountId", awsAccountId()).add("AnalysisId", analysisId())
.add("Name", name()).add("Parameters", parameters()).add("Permissions", hasPermissions() ? permissions() : null)
.add("SourceEntity", sourceEntity()).add("ThemeArn", themeArn()).add("Tags", hasTags() ? tags() : null).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AwsAccountId":
return Optional.ofNullable(clazz.cast(awsAccountId()));
case "AnalysisId":
return Optional.ofNullable(clazz.cast(analysisId()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Parameters":
return Optional.ofNullable(clazz.cast(parameters()));
case "Permissions":
return Optional.ofNullable(clazz.cast(permissions()));
case "SourceEntity":
return Optional.ofNullable(clazz.cast(sourceEntity()));
case "ThemeArn":
return Optional.ofNullable(clazz.cast(themeArn()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* To specify no permissions, omit Permissions
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder permissions(Collection permissions);
/**
*
* A structure that describes the principals and the resource-level permissions on an analysis. You can use the
* Permissions
structure to grant permissions by providing a list of AWS Identity and Access
* Management (IAM) action information for each principal listed by Amazon Resource Name (ARN).
*
*
* To specify no permissions, omit Permissions
.
*
*
* @param permissions
* A structure that describes the principals and the resource-level permissions on an analysis. You can
* use the Permissions
structure to grant permissions by providing a list of AWS Identity
* and Access Management (IAM) action information for each principal listed by Amazon Resource Name
* (ARN).
*
* To specify no permissions, omit Permissions
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder permissions(ResourcePermission... permissions);
/**
*
* A structure that describes the principals and the resource-level permissions on an analysis. You can use the
* Permissions
structure to grant permissions by providing a list of AWS Identity and Access
* Management (IAM) action information for each principal listed by Amazon Resource Name (ARN).
*
*
* To specify no permissions, omit Permissions
.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the
* need to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately
* and its result is passed to {@link #permissions(List)}.
*
* @param permissions
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #permissions(List)
*/
Builder permissions(Consumer... permissions);
/**
*
* A source entity to use for the analysis that you're creating. This metadata structure contains details that
* describe a source template and one or more datasets.
*
*
* @param sourceEntity
* A source entity to use for the analysis that you're creating. This metadata structure contains details
* that describe a source template and one or more datasets.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sourceEntity(AnalysisSourceEntity sourceEntity);
/**
*
* A source entity to use for the analysis that you're creating. This metadata structure contains details that
* describe a source template and one or more datasets.
*
* This is a convenience that creates an instance of the {@link AnalysisSourceEntity.Builder} avoiding the need
* to create one manually via {@link AnalysisSourceEntity#builder()}.
*
* When the {@link Consumer} completes, {@link AnalysisSourceEntity.Builder#build()} is called immediately and
* its result is passed to {@link #sourceEntity(AnalysisSourceEntity)}.
*
* @param sourceEntity
* a consumer that will call methods on {@link AnalysisSourceEntity.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #sourceEntity(AnalysisSourceEntity)
*/
default Builder sourceEntity(Consumer sourceEntity) {
return sourceEntity(AnalysisSourceEntity.builder().applyMutation(sourceEntity).build());
}
/**
*
* The ARN for the theme to apply to the analysis that you're creating. To see the theme in the QuickSight
* console, make sure that you have access to it.
*
*
* @param themeArn
* The ARN for the theme to apply to the analysis that you're creating. To see the theme in the
* QuickSight console, make sure that you have access to it.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder themeArn(String themeArn);
/**
*
* Contains a map of the key-value pairs for the resource tag or tags assigned to the analysis.
*
*
* @param tags
* Contains a map of the key-value pairs for the resource tag or tags assigned to the analysis.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Collection tags);
/**
*
* Contains a map of the key-value pairs for the resource tag or tags assigned to the analysis.
*
*
* @param tags
* Contains a map of the key-value pairs for the resource tag or tags assigned to the analysis.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Tag... tags);
/**
*
* Contains a map of the key-value pairs for the resource tag or tags assigned to the analysis.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to create
* one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result
* is passed to {@link #tags(List)}.
*
* @param tags
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #tags(List)
*/
Builder tags(Consumer... tags);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends QuickSightRequest.BuilderImpl implements Builder {
private String awsAccountId;
private String analysisId;
private String name;
private Parameters parameters;
private List permissions = DefaultSdkAutoConstructList.getInstance();
private AnalysisSourceEntity sourceEntity;
private String themeArn;
private List tags = DefaultSdkAutoConstructList.getInstance();
private BuilderImpl() {
}
private BuilderImpl(CreateAnalysisRequest model) {
super(model);
awsAccountId(model.awsAccountId);
analysisId(model.analysisId);
name(model.name);
parameters(model.parameters);
permissions(model.permissions);
sourceEntity(model.sourceEntity);
themeArn(model.themeArn);
tags(model.tags);
}
public final String getAwsAccountId() {
return awsAccountId;
}
@Override
public final Builder awsAccountId(String awsAccountId) {
this.awsAccountId = awsAccountId;
return this;
}
public final void setAwsAccountId(String awsAccountId) {
this.awsAccountId = awsAccountId;
}
public final String getAnalysisId() {
return analysisId;
}
@Override
public final Builder analysisId(String analysisId) {
this.analysisId = analysisId;
return this;
}
public final void setAnalysisId(String analysisId) {
this.analysisId = analysisId;
}
public final String getName() {
return name;
}
@Override
public final Builder name(String name) {
this.name = name;
return this;
}
public final void setName(String name) {
this.name = name;
}
public final Parameters.Builder getParameters() {
return parameters != null ? parameters.toBuilder() : null;
}
@Override
public final Builder parameters(Parameters parameters) {
this.parameters = parameters;
return this;
}
public final void setParameters(Parameters.BuilderImpl parameters) {
this.parameters = parameters != null ? parameters.build() : null;
}
public final Collection getPermissions() {
if (permissions instanceof SdkAutoConstructList) {
return null;
}
return permissions != null ? permissions.stream().map(ResourcePermission::toBuilder).collect(Collectors.toList())
: null;
}
@Override
public final Builder permissions(Collection permissions) {
this.permissions = ResourcePermissionListCopier.copy(permissions);
return this;
}
@Override
@SafeVarargs
public final Builder permissions(ResourcePermission... permissions) {
permissions(Arrays.asList(permissions));
return this;
}
@Override
@SafeVarargs
public final Builder permissions(Consumer... permissions) {
permissions(Stream.of(permissions).map(c -> ResourcePermission.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final void setPermissions(Collection permissions) {
this.permissions = ResourcePermissionListCopier.copyFromBuilder(permissions);
}
public final AnalysisSourceEntity.Builder getSourceEntity() {
return sourceEntity != null ? sourceEntity.toBuilder() : null;
}
@Override
public final Builder sourceEntity(AnalysisSourceEntity sourceEntity) {
this.sourceEntity = sourceEntity;
return this;
}
public final void setSourceEntity(AnalysisSourceEntity.BuilderImpl sourceEntity) {
this.sourceEntity = sourceEntity != null ? sourceEntity.build() : null;
}
public final String getThemeArn() {
return themeArn;
}
@Override
public final Builder themeArn(String themeArn) {
this.themeArn = themeArn;
return this;
}
public final void setThemeArn(String themeArn) {
this.themeArn = themeArn;
}
public final Collection getTags() {
if (tags instanceof SdkAutoConstructList) {
return null;
}
return tags != null ? tags.stream().map(Tag::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder tags(Collection tags) {
this.tags = TagListCopier.copy(tags);
return this;
}
@Override
@SafeVarargs
public final Builder tags(Tag... tags) {
tags(Arrays.asList(tags));
return this;
}
@Override
@SafeVarargs
public final Builder tags(Consumer... tags) {
tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
public final void setTags(Collection tags) {
this.tags = TagListCopier.copyFromBuilder(tags);
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public CreateAnalysisRequest build() {
return new CreateAnalysisRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}