
software.amazon.awssdk.services.athena.model.ResultConfiguration 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.athena.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.Consumer;
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;
/**
*
* The location in Amazon S3 where query and calculation results are stored and the encryption option, if any, used for
* query and calculation results. These are known as "client-side settings". If workgroup settings override client-side
* settings, then the query uses the workgroup settings.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ResultConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField OUTPUT_LOCATION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OutputLocation").getter(getter(ResultConfiguration::outputLocation))
.setter(setter(Builder::outputLocation))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutputLocation").build()).build();
private static final SdkField ENCRYPTION_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("EncryptionConfiguration")
.getter(getter(ResultConfiguration::encryptionConfiguration)).setter(setter(Builder::encryptionConfiguration))
.constructor(EncryptionConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EncryptionConfiguration").build())
.build();
private static final SdkField EXPECTED_BUCKET_OWNER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ExpectedBucketOwner").getter(getter(ResultConfiguration::expectedBucketOwner))
.setter(setter(Builder::expectedBucketOwner))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExpectedBucketOwner").build())
.build();
private static final SdkField ACL_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("AclConfiguration")
.getter(getter(ResultConfiguration::aclConfiguration)).setter(setter(Builder::aclConfiguration))
.constructor(AclConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AclConfiguration").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(OUTPUT_LOCATION_FIELD,
ENCRYPTION_CONFIGURATION_FIELD, EXPECTED_BUCKET_OWNER_FIELD, ACL_CONFIGURATION_FIELD));
private static final long serialVersionUID = 1L;
private final String outputLocation;
private final EncryptionConfiguration encryptionConfiguration;
private final String expectedBucketOwner;
private final AclConfiguration aclConfiguration;
private ResultConfiguration(BuilderImpl builder) {
this.outputLocation = builder.outputLocation;
this.encryptionConfiguration = builder.encryptionConfiguration;
this.expectedBucketOwner = builder.expectedBucketOwner;
this.aclConfiguration = builder.aclConfiguration;
}
/**
*
* The location in Amazon S3 where your query and calculation results are stored, such as
* s3://path/to/query/bucket/
. To run the query, you must specify the query results location using one
* of the ways: either for individual queries using either this setting (client-side), or in the workgroup, using
* WorkGroupConfiguration. If none of them is set, Athena issues an error that no output location is
* provided. For more information, see Working
* with query results, recent queries, and output files. If workgroup settings override client-side settings,
* then the query uses the settings specified for the workgroup. See
* WorkGroupConfiguration$EnforceWorkGroupConfiguration.
*
*
* @return The location in Amazon S3 where your query and calculation results are stored, such as
* s3://path/to/query/bucket/
. To run the query, you must specify the query results location
* using one of the ways: either for individual queries using either this setting (client-side), or in the
* workgroup, using WorkGroupConfiguration. If none of them is set, Athena issues an error that no
* output location is provided. For more information, see Working with query results, recent
* queries, and output files. If workgroup settings override client-side settings, then the query uses
* the settings specified for the workgroup. See
* WorkGroupConfiguration$EnforceWorkGroupConfiguration.
*/
public final String outputLocation() {
return outputLocation;
}
/**
*
* If query and calculation results are encrypted in Amazon S3, indicates the encryption option used (for example,
* SSE_KMS
or CSE_KMS
) and key information. This is a client-side setting. If workgroup
* settings override client-side settings, then the query uses the encryption configuration that is specified for
* the workgroup, and also uses the location for storing query results specified in the workgroup. See
* WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override
* Client-Side Settings.
*
*
* @return If query and calculation results are encrypted in Amazon S3, indicates the encryption option used (for
* example, SSE_KMS
or CSE_KMS
) and key information. This is a client-side
* setting. If workgroup settings override client-side settings, then the query uses the encryption
* configuration that is specified for the workgroup, and also uses the location for storing query results
* specified in the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings
* Override Client-Side Settings.
*/
public final EncryptionConfiguration encryptionConfiguration() {
return encryptionConfiguration;
}
/**
*
* The Amazon Web Services account ID that you expect to be the owner of the Amazon S3 bucket specified by
* ResultConfiguration$OutputLocation. If set, Athena uses the value for ExpectedBucketOwner
* when it makes Amazon S3 calls to your specified output location. If the ExpectedBucketOwner
Amazon
* Web Services account ID does not match the actual owner of the Amazon S3 bucket, the call fails with a
* permissions error.
*
*
* This is a client-side setting. If workgroup settings override client-side settings, then the query uses the
* ExpectedBucketOwner
setting that is specified for the workgroup, and also uses the location for
* storing query results specified in the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration
* and Workgroup Settings
* Override Client-Side Settings.
*
*
* @return The Amazon Web Services account ID that you expect to be the owner of the Amazon S3 bucket specified by
* ResultConfiguration$OutputLocation. If set, Athena uses the value for
* ExpectedBucketOwner
when it makes Amazon S3 calls to your specified output location. If the
* ExpectedBucketOwner
Amazon Web Services account ID does not match the actual owner of the
* Amazon S3 bucket, the call fails with a permissions error.
*
* This is a client-side setting. If workgroup settings override client-side settings, then the query uses
* the ExpectedBucketOwner
setting that is specified for the workgroup, and also uses the
* location for storing query results specified in the workgroup. See
* WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings
* Override Client-Side Settings.
*/
public final String expectedBucketOwner() {
return expectedBucketOwner;
}
/**
*
* Indicates that an Amazon S3 canned ACL should be set to control ownership of stored query results. Currently the
* only supported canned ACL is BUCKET_OWNER_FULL_CONTROL
. This is a client-side setting. If workgroup
* settings override client-side settings, then the query uses the ACL configuration that is specified for the
* workgroup, and also uses the location for storing query results specified in the workgroup. For more information,
* see WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override
* Client-Side Settings.
*
*
* @return Indicates that an Amazon S3 canned ACL should be set to control ownership of stored query results.
* Currently the only supported canned ACL is BUCKET_OWNER_FULL_CONTROL
. This is a client-side
* setting. If workgroup settings override client-side settings, then the query uses the ACL configuration
* that is specified for the workgroup, and also uses the location for storing query results specified in
* the workgroup. For more information, see WorkGroupConfiguration$EnforceWorkGroupConfiguration and
* Workgroup
* Settings Override Client-Side Settings.
*/
public final AclConfiguration aclConfiguration() {
return aclConfiguration;
}
@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(outputLocation());
hashCode = 31 * hashCode + Objects.hashCode(encryptionConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(expectedBucketOwner());
hashCode = 31 * hashCode + Objects.hashCode(aclConfiguration());
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 ResultConfiguration)) {
return false;
}
ResultConfiguration other = (ResultConfiguration) obj;
return Objects.equals(outputLocation(), other.outputLocation())
&& Objects.equals(encryptionConfiguration(), other.encryptionConfiguration())
&& Objects.equals(expectedBucketOwner(), other.expectedBucketOwner())
&& Objects.equals(aclConfiguration(), other.aclConfiguration());
}
/**
* 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("ResultConfiguration").add("OutputLocation", outputLocation())
.add("EncryptionConfiguration", encryptionConfiguration()).add("ExpectedBucketOwner", expectedBucketOwner())
.add("AclConfiguration", aclConfiguration()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "OutputLocation":
return Optional.ofNullable(clazz.cast(outputLocation()));
case "EncryptionConfiguration":
return Optional.ofNullable(clazz.cast(encryptionConfiguration()));
case "ExpectedBucketOwner":
return Optional.ofNullable(clazz.cast(expectedBucketOwner()));
case "AclConfiguration":
return Optional.ofNullable(clazz.cast(aclConfiguration()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function