software.amazon.awssdk.services.cleanrooms.model.AnalysisRuleAggregation Maven / Gradle / Ivy
Show all versions of cleanrooms 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.cleanrooms.model;
import java.io.Serializable;
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.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;
/**
*
* A type of analysis rule that enables query structure and specified queries that produce aggregate statistics.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AnalysisRuleAggregation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField> AGGREGATE_COLUMNS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("aggregateColumns")
.getter(getter(AnalysisRuleAggregation::aggregateColumns))
.setter(setter(Builder::aggregateColumns))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("aggregateColumns").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AggregateColumn::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> JOIN_COLUMNS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("joinColumns")
.getter(getter(AnalysisRuleAggregation::joinColumns))
.setter(setter(Builder::joinColumns))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("joinColumns").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField JOIN_REQUIRED_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("joinRequired").getter(getter(AnalysisRuleAggregation::joinRequiredAsString))
.setter(setter(Builder::joinRequired))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("joinRequired").build()).build();
private static final SdkField> ALLOWED_JOIN_OPERATORS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("allowedJoinOperators")
.getter(getter(AnalysisRuleAggregation::allowedJoinOperatorsAsStrings))
.setter(setter(Builder::allowedJoinOperatorsWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("allowedJoinOperators").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> DIMENSION_COLUMNS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("dimensionColumns")
.getter(getter(AnalysisRuleAggregation::dimensionColumns))
.setter(setter(Builder::dimensionColumns))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dimensionColumns").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> SCALAR_FUNCTIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("scalarFunctions")
.getter(getter(AnalysisRuleAggregation::scalarFunctionsAsStrings))
.setter(setter(Builder::scalarFunctionsWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("scalarFunctions").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> OUTPUT_CONSTRAINTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("outputConstraints")
.getter(getter(AnalysisRuleAggregation::outputConstraints))
.setter(setter(Builder::outputConstraints))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("outputConstraints").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AggregationConstraint::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField ADDITIONAL_ANALYSES_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("additionalAnalyses").getter(getter(AnalysisRuleAggregation::additionalAnalysesAsString))
.setter(setter(Builder::additionalAnalyses))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("additionalAnalyses").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AGGREGATE_COLUMNS_FIELD,
JOIN_COLUMNS_FIELD, JOIN_REQUIRED_FIELD, ALLOWED_JOIN_OPERATORS_FIELD, DIMENSION_COLUMNS_FIELD,
SCALAR_FUNCTIONS_FIELD, OUTPUT_CONSTRAINTS_FIELD, ADDITIONAL_ANALYSES_FIELD));
private static final long serialVersionUID = 1L;
private final List aggregateColumns;
private final List joinColumns;
private final String joinRequired;
private final List allowedJoinOperators;
private final List dimensionColumns;
private final List scalarFunctions;
private final List outputConstraints;
private final String additionalAnalyses;
private AnalysisRuleAggregation(BuilderImpl builder) {
this.aggregateColumns = builder.aggregateColumns;
this.joinColumns = builder.joinColumns;
this.joinRequired = builder.joinRequired;
this.allowedJoinOperators = builder.allowedJoinOperators;
this.dimensionColumns = builder.dimensionColumns;
this.scalarFunctions = builder.scalarFunctions;
this.outputConstraints = builder.outputConstraints;
this.additionalAnalyses = builder.additionalAnalyses;
}
/**
* For responses, this returns true if the service returned a value for the AggregateColumns 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 hasAggregateColumns() {
return aggregateColumns != null && !(aggregateColumns instanceof SdkAutoConstructList);
}
/**
*
* The columns that query runners are allowed to use in aggregation queries.
*
*
* 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 #hasAggregateColumns} method.
*
*
* @return The columns that query runners are allowed to use in aggregation queries.
*/
public final List aggregateColumns() {
return aggregateColumns;
}
/**
* For responses, this returns true if the service returned a value for the JoinColumns 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 hasJoinColumns() {
return joinColumns != null && !(joinColumns instanceof SdkAutoConstructList);
}
/**
*
* Columns in configured table that can be used in join statements and/or as aggregate columns. They can never be
* outputted directly.
*
*
* 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 #hasJoinColumns} method.
*
*
* @return Columns in configured table that can be used in join statements and/or as aggregate columns. They can
* never be outputted directly.
*/
public final List joinColumns() {
return joinColumns;
}
/**
*
* Control that requires member who runs query to do a join with their configured table and/or other configured
* table in query.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #joinRequired} will
* return {@link JoinRequiredOption#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #joinRequiredAsString}.
*
*
* @return Control that requires member who runs query to do a join with their configured table and/or other
* configured table in query.
* @see JoinRequiredOption
*/
public final JoinRequiredOption joinRequired() {
return JoinRequiredOption.fromValue(joinRequired);
}
/**
*
* Control that requires member who runs query to do a join with their configured table and/or other configured
* table in query.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #joinRequired} will
* return {@link JoinRequiredOption#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #joinRequiredAsString}.
*
*
* @return Control that requires member who runs query to do a join with their configured table and/or other
* configured table in query.
* @see JoinRequiredOption
*/
public final String joinRequiredAsString() {
return joinRequired;
}
/**
*
* Which logical operators (if any) are to be used in an INNER JOIN match condition. Default is AND
.
*
*
* 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 #hasAllowedJoinOperators} method.
*
*
* @return Which logical operators (if any) are to be used in an INNER JOIN match condition. Default is
* AND
.
*/
public final List allowedJoinOperators() {
return JoinOperatorsListCopier.copyStringToEnum(allowedJoinOperators);
}
/**
* For responses, this returns true if the service returned a value for the AllowedJoinOperators 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 hasAllowedJoinOperators() {
return allowedJoinOperators != null && !(allowedJoinOperators instanceof SdkAutoConstructList);
}
/**
*
* Which logical operators (if any) are to be used in an INNER JOIN match condition. Default is AND
.
*
*
* 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 #hasAllowedJoinOperators} method.
*
*
* @return Which logical operators (if any) are to be used in an INNER JOIN match condition. Default is
* AND
.
*/
public final List allowedJoinOperatorsAsStrings() {
return allowedJoinOperators;
}
/**
* For responses, this returns true if the service returned a value for the DimensionColumns 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 hasDimensionColumns() {
return dimensionColumns != null && !(dimensionColumns instanceof SdkAutoConstructList);
}
/**
*
* The columns that query runners are allowed to select, group by, or filter by.
*
*
* 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 #hasDimensionColumns} method.
*
*
* @return The columns that query runners are allowed to select, group by, or filter by.
*/
public final List dimensionColumns() {
return dimensionColumns;
}
/**
*
* Set of scalar functions that are allowed to be used on dimension columns and the output of aggregation of
* metrics.
*
*
* 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 #hasScalarFunctions} method.
*
*
* @return Set of scalar functions that are allowed to be used on dimension columns and the output of aggregation of
* metrics.
*/
public final List scalarFunctions() {
return ScalarFunctionsListCopier.copyStringToEnum(scalarFunctions);
}
/**
* For responses, this returns true if the service returned a value for the ScalarFunctions 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 hasScalarFunctions() {
return scalarFunctions != null && !(scalarFunctions instanceof SdkAutoConstructList);
}
/**
*
* Set of scalar functions that are allowed to be used on dimension columns and the output of aggregation of
* metrics.
*
*
* 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 #hasScalarFunctions} method.
*
*
* @return Set of scalar functions that are allowed to be used on dimension columns and the output of aggregation of
* metrics.
*/
public final List scalarFunctionsAsStrings() {
return scalarFunctions;
}
/**
* For responses, this returns true if the service returned a value for the OutputConstraints 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 hasOutputConstraints() {
return outputConstraints != null && !(outputConstraints instanceof SdkAutoConstructList);
}
/**
*
* Columns that must meet a specific threshold value (after an aggregation function is applied to it) for each
* output row to be returned.
*
*
* 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 #hasOutputConstraints} method.
*
*
* @return Columns that must meet a specific threshold value (after an aggregation function is applied to it) for
* each output row to be returned.
*/
public final List outputConstraints() {
return outputConstraints;
}
/**
*
* An indicator as to whether additional analyses (such as Clean Rooms ML) can be applied to the output of the
* direct query.
*
*
* The additionalAnalyses
parameter is currently supported for the list analysis rule (
* AnalysisRuleList
) and the custom analysis rule (AnalysisRuleCustom
).
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #additionalAnalyses} will return {@link AdditionalAnalyses#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #additionalAnalysesAsString}.
*
*
* @return An indicator as to whether additional analyses (such as Clean Rooms ML) can be applied to the output of
* the direct query.
*
* The additionalAnalyses
parameter is currently supported for the list analysis rule (
* AnalysisRuleList
) and the custom analysis rule (AnalysisRuleCustom
).
* @see AdditionalAnalyses
*/
public final AdditionalAnalyses additionalAnalyses() {
return AdditionalAnalyses.fromValue(additionalAnalyses);
}
/**
*
* An indicator as to whether additional analyses (such as Clean Rooms ML) can be applied to the output of the
* direct query.
*
*
* The additionalAnalyses
parameter is currently supported for the list analysis rule (
* AnalysisRuleList
) and the custom analysis rule (AnalysisRuleCustom
).
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #additionalAnalyses} will return {@link AdditionalAnalyses#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #additionalAnalysesAsString}.
*
*
* @return An indicator as to whether additional analyses (such as Clean Rooms ML) can be applied to the output of
* the direct query.
*
* The additionalAnalyses
parameter is currently supported for the list analysis rule (
* AnalysisRuleList
) and the custom analysis rule (AnalysisRuleCustom
).
* @see AdditionalAnalyses
*/
public final String additionalAnalysesAsString() {
return additionalAnalyses;
}
@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(hasAggregateColumns() ? aggregateColumns() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasJoinColumns() ? joinColumns() : null);
hashCode = 31 * hashCode + Objects.hashCode(joinRequiredAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasAllowedJoinOperators() ? allowedJoinOperatorsAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasDimensionColumns() ? dimensionColumns() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasScalarFunctions() ? scalarFunctionsAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasOutputConstraints() ? outputConstraints() : null);
hashCode = 31 * hashCode + Objects.hashCode(additionalAnalysesAsString());
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 AnalysisRuleAggregation)) {
return false;
}
AnalysisRuleAggregation other = (AnalysisRuleAggregation) obj;
return hasAggregateColumns() == other.hasAggregateColumns()
&& Objects.equals(aggregateColumns(), other.aggregateColumns()) && hasJoinColumns() == other.hasJoinColumns()
&& Objects.equals(joinColumns(), other.joinColumns())
&& Objects.equals(joinRequiredAsString(), other.joinRequiredAsString())
&& hasAllowedJoinOperators() == other.hasAllowedJoinOperators()
&& Objects.equals(allowedJoinOperatorsAsStrings(), other.allowedJoinOperatorsAsStrings())
&& hasDimensionColumns() == other.hasDimensionColumns()
&& Objects.equals(dimensionColumns(), other.dimensionColumns())
&& hasScalarFunctions() == other.hasScalarFunctions()
&& Objects.equals(scalarFunctionsAsStrings(), other.scalarFunctionsAsStrings())
&& hasOutputConstraints() == other.hasOutputConstraints()
&& Objects.equals(outputConstraints(), other.outputConstraints())
&& Objects.equals(additionalAnalysesAsString(), other.additionalAnalysesAsString());
}
/**
* 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("AnalysisRuleAggregation")
.add("AggregateColumns", hasAggregateColumns() ? aggregateColumns() : null)
.add("JoinColumns", hasJoinColumns() ? joinColumns() : null).add("JoinRequired", joinRequiredAsString())
.add("AllowedJoinOperators", hasAllowedJoinOperators() ? allowedJoinOperatorsAsStrings() : null)
.add("DimensionColumns", hasDimensionColumns() ? dimensionColumns() : null)
.add("ScalarFunctions", hasScalarFunctions() ? scalarFunctionsAsStrings() : null)
.add("OutputConstraints", hasOutputConstraints() ? outputConstraints() : null)
.add("AdditionalAnalyses", additionalAnalysesAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "aggregateColumns":
return Optional.ofNullable(clazz.cast(aggregateColumns()));
case "joinColumns":
return Optional.ofNullable(clazz.cast(joinColumns()));
case "joinRequired":
return Optional.ofNullable(clazz.cast(joinRequiredAsString()));
case "allowedJoinOperators":
return Optional.ofNullable(clazz.cast(allowedJoinOperatorsAsStrings()));
case "dimensionColumns":
return Optional.ofNullable(clazz.cast(dimensionColumns()));
case "scalarFunctions":
return Optional.ofNullable(clazz.cast(scalarFunctionsAsStrings()));
case "outputConstraints":
return Optional.ofNullable(clazz.cast(outputConstraints()));
case "additionalAnalyses":
return Optional.ofNullable(clazz.cast(additionalAnalysesAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function