software.amazon.awssdk.services.s3.model.AnalyticsConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of s3 Show documentation
Show all versions of s3 Show documentation
The AWS Java SDK for Amazon S3 module holds the client classes that are used for communicating with
Amazon Simple Storage Service
/*
* Copyright 2014-2019 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.s3.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;
/**
*
* Specifies the configuration and any analyses for the analytics filter of an Amazon S3 bucket.
*
*
* For more information, see GET Bucket analytics in
* the Amazon Simple Storage Service API Reference.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AnalyticsConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.getter(getter(AnalyticsConfiguration::id))
.setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").unmarshallLocationName("Id")
.build()).build();
private static final SdkField FILTER_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.getter(getter(AnalyticsConfiguration::filter))
.setter(setter(Builder::filter))
.constructor(AnalyticsFilter::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Filter")
.unmarshallLocationName("Filter").build()).build();
private static final SdkField STORAGE_CLASS_ANALYSIS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.getter(getter(AnalyticsConfiguration::storageClassAnalysis))
.setter(setter(Builder::storageClassAnalysis))
.constructor(StorageClassAnalysis::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StorageClassAnalysis")
.unmarshallLocationName("StorageClassAnalysis").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, FILTER_FIELD,
STORAGE_CLASS_ANALYSIS_FIELD));
private static final long serialVersionUID = 1L;
private final String id;
private final AnalyticsFilter filter;
private final StorageClassAnalysis storageClassAnalysis;
private AnalyticsConfiguration(BuilderImpl builder) {
this.id = builder.id;
this.filter = builder.filter;
this.storageClassAnalysis = builder.storageClassAnalysis;
}
/**
*
* The ID that identifies the analytics configuration.
*
*
* @return The ID that identifies the analytics configuration.
*/
public String id() {
return id;
}
/**
*
* The filter used to describe a set of objects for analyses. A filter must have exactly one prefix, one tag, or one
* conjunction (AnalyticsAndOperator). If no filter is provided, all objects will be considered in any analysis.
*
*
* @return The filter used to describe a set of objects for analyses. A filter must have exactly one prefix, one
* tag, or one conjunction (AnalyticsAndOperator). If no filter is provided, all objects will be considered
* in any analysis.
*/
public AnalyticsFilter filter() {
return filter;
}
/**
*
* Contains data related to access patterns to be collected and made available to analyze the tradeoffs between
* different storage classes.
*
*
* @return Contains data related to access patterns to be collected and made available to analyze the tradeoffs
* between different storage classes.
*/
public StorageClassAnalysis storageClassAnalysis() {
return storageClassAnalysis;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(filter());
hashCode = 31 * hashCode + Objects.hashCode(storageClassAnalysis());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof AnalyticsConfiguration)) {
return false;
}
AnalyticsConfiguration other = (AnalyticsConfiguration) obj;
return Objects.equals(id(), other.id()) && Objects.equals(filter(), other.filter())
&& Objects.equals(storageClassAnalysis(), other.storageClassAnalysis());
}
/**
* 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("AnalyticsConfiguration").add("Id", id()).add("Filter", filter())
.add("StorageClassAnalysis", storageClassAnalysis()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Filter":
return Optional.ofNullable(clazz.cast(filter()));
case "StorageClassAnalysis":
return Optional.ofNullable(clazz.cast(storageClassAnalysis()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function