software.amazon.awssdk.services.cleanrooms.model.DifferentialPrivacySensitivityParameters 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.Collections;
import java.util.List;
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 the sensitivity parameters.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DifferentialPrivacySensitivityParameters implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField AGGREGATION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("aggregationType").getter(getter(DifferentialPrivacySensitivityParameters::aggregationTypeAsString))
.setter(setter(Builder::aggregationType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("aggregationType").build()).build();
private static final SdkField AGGREGATION_EXPRESSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("aggregationExpression").getter(getter(DifferentialPrivacySensitivityParameters::aggregationExpression))
.setter(setter(Builder::aggregationExpression))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("aggregationExpression").build())
.build();
private static final SdkField USER_CONTRIBUTION_LIMIT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("userContributionLimit").getter(getter(DifferentialPrivacySensitivityParameters::userContributionLimit))
.setter(setter(Builder::userContributionLimit))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("userContributionLimit").build())
.build();
private static final SdkField MIN_COLUMN_VALUE_FIELD = SdkField. builder(MarshallingType.FLOAT)
.memberName("minColumnValue").getter(getter(DifferentialPrivacySensitivityParameters::minColumnValue))
.setter(setter(Builder::minColumnValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("minColumnValue").build()).build();
private static final SdkField MAX_COLUMN_VALUE_FIELD = SdkField. builder(MarshallingType.FLOAT)
.memberName("maxColumnValue").getter(getter(DifferentialPrivacySensitivityParameters::maxColumnValue))
.setter(setter(Builder::maxColumnValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("maxColumnValue").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AGGREGATION_TYPE_FIELD,
AGGREGATION_EXPRESSION_FIELD, USER_CONTRIBUTION_LIMIT_FIELD, MIN_COLUMN_VALUE_FIELD, MAX_COLUMN_VALUE_FIELD));
private static final long serialVersionUID = 1L;
private final String aggregationType;
private final String aggregationExpression;
private final Integer userContributionLimit;
private final Float minColumnValue;
private final Float maxColumnValue;
private DifferentialPrivacySensitivityParameters(BuilderImpl builder) {
this.aggregationType = builder.aggregationType;
this.aggregationExpression = builder.aggregationExpression;
this.userContributionLimit = builder.userContributionLimit;
this.minColumnValue = builder.minColumnValue;
this.maxColumnValue = builder.maxColumnValue;
}
/**
*
* The type of aggregation function that was run.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #aggregationType}
* will return {@link DifferentialPrivacyAggregationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the
* service is available from {@link #aggregationTypeAsString}.
*
*
* @return The type of aggregation function that was run.
* @see DifferentialPrivacyAggregationType
*/
public final DifferentialPrivacyAggregationType aggregationType() {
return DifferentialPrivacyAggregationType.fromValue(aggregationType);
}
/**
*
* The type of aggregation function that was run.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #aggregationType}
* will return {@link DifferentialPrivacyAggregationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the
* service is available from {@link #aggregationTypeAsString}.
*
*
* @return The type of aggregation function that was run.
* @see DifferentialPrivacyAggregationType
*/
public final String aggregationTypeAsString() {
return aggregationType;
}
/**
*
* The aggregation expression that was run.
*
*
* @return The aggregation expression that was run.
*/
public final String aggregationExpression() {
return aggregationExpression;
}
/**
*
* The maximum number of rows contributed by a user in a SQL query.
*
*
* @return The maximum number of rows contributed by a user in a SQL query.
*/
public final Integer userContributionLimit() {
return userContributionLimit;
}
/**
*
* The lower bound of the aggregation expression.
*
*
* @return The lower bound of the aggregation expression.
*/
public final Float minColumnValue() {
return minColumnValue;
}
/**
*
* The upper bound of the aggregation expression.
*
*
* @return The upper bound of the aggregation expression.
*/
public final Float maxColumnValue() {
return maxColumnValue;
}
@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(aggregationTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(aggregationExpression());
hashCode = 31 * hashCode + Objects.hashCode(userContributionLimit());
hashCode = 31 * hashCode + Objects.hashCode(minColumnValue());
hashCode = 31 * hashCode + Objects.hashCode(maxColumnValue());
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 DifferentialPrivacySensitivityParameters)) {
return false;
}
DifferentialPrivacySensitivityParameters other = (DifferentialPrivacySensitivityParameters) obj;
return Objects.equals(aggregationTypeAsString(), other.aggregationTypeAsString())
&& Objects.equals(aggregationExpression(), other.aggregationExpression())
&& Objects.equals(userContributionLimit(), other.userContributionLimit())
&& Objects.equals(minColumnValue(), other.minColumnValue())
&& Objects.equals(maxColumnValue(), other.maxColumnValue());
}
/**
* 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("DifferentialPrivacySensitivityParameters").add("AggregationType", aggregationTypeAsString())
.add("AggregationExpression", aggregationExpression()).add("UserContributionLimit", userContributionLimit())
.add("MinColumnValue", minColumnValue()).add("MaxColumnValue", maxColumnValue()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "aggregationType":
return Optional.ofNullable(clazz.cast(aggregationTypeAsString()));
case "aggregationExpression":
return Optional.ofNullable(clazz.cast(aggregationExpression()));
case "userContributionLimit":
return Optional.ofNullable(clazz.cast(userContributionLimit()));
case "minColumnValue":
return Optional.ofNullable(clazz.cast(minColumnValue()));
case "maxColumnValue":
return Optional.ofNullable(clazz.cast(maxColumnValue()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function