All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.s3.model.AnalyticsConfiguration Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon S3 module holds the client classes that are used for communicating with Amazon Simple Storage Service

There is a newer version: 2.25.55
Show newest version
/*
 * 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 getter(Function g) { return obj -> g.apply((AnalyticsConfiguration) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID that identifies the analytics configuration. *

* * @param id * The ID that identifies the analytics configuration. * @return Returns a reference to this object so that method calls can be chained together. */ Builder id(String 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. *

* * @param filter * 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 Returns a reference to this object so that method calls can be chained together. */ Builder filter(AnalyticsFilter filter); /** *

* 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. *

* This is a convenience that creates an instance of the {@link AnalyticsFilter.Builder} avoiding the need to * create one manually via {@link AnalyticsFilter#builder()}. * * When the {@link Consumer} completes, {@link AnalyticsFilter.Builder#build()} is called immediately and its * result is passed to {@link #filter(AnalyticsFilter)}. * * @param filter * a consumer that will call methods on {@link AnalyticsFilter.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #filter(AnalyticsFilter) */ default Builder filter(Consumer filter) { return filter(AnalyticsFilter.builder().applyMutation(filter).build()); } /** *

* Contains data related to access patterns to be collected and made available to analyze the tradeoffs between * different storage classes. *

* * @param storageClassAnalysis * Contains data related to access patterns to be collected and made available to analyze the tradeoffs * between different storage classes. * @return Returns a reference to this object so that method calls can be chained together. */ Builder storageClassAnalysis(StorageClassAnalysis storageClassAnalysis); /** *

* Contains data related to access patterns to be collected and made available to analyze the tradeoffs between * different storage classes. *

* This is a convenience that creates an instance of the {@link StorageClassAnalysis.Builder} avoiding the need * to create one manually via {@link StorageClassAnalysis#builder()}. * * When the {@link Consumer} completes, {@link StorageClassAnalysis.Builder#build()} is called immediately and * its result is passed to {@link #storageClassAnalysis(StorageClassAnalysis)}. * * @param storageClassAnalysis * a consumer that will call methods on {@link StorageClassAnalysis.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #storageClassAnalysis(StorageClassAnalysis) */ default Builder storageClassAnalysis(Consumer storageClassAnalysis) { return storageClassAnalysis(StorageClassAnalysis.builder().applyMutation(storageClassAnalysis).build()); } } static final class BuilderImpl implements Builder { private String id; private AnalyticsFilter filter; private StorageClassAnalysis storageClassAnalysis; private BuilderImpl() { } private BuilderImpl(AnalyticsConfiguration model) { id(model.id); filter(model.filter); storageClassAnalysis(model.storageClassAnalysis); } public final String getId() { return id; } @Override public final Builder id(String id) { this.id = id; return this; } public final void setId(String id) { this.id = id; } public final AnalyticsFilter.Builder getFilter() { return filter != null ? filter.toBuilder() : null; } @Override public final Builder filter(AnalyticsFilter filter) { this.filter = filter; return this; } public final void setFilter(AnalyticsFilter.BuilderImpl filter) { this.filter = filter != null ? filter.build() : null; } public final StorageClassAnalysis.Builder getStorageClassAnalysis() { return storageClassAnalysis != null ? storageClassAnalysis.toBuilder() : null; } @Override public final Builder storageClassAnalysis(StorageClassAnalysis storageClassAnalysis) { this.storageClassAnalysis = storageClassAnalysis; return this; } public final void setStorageClassAnalysis(StorageClassAnalysis.BuilderImpl storageClassAnalysis) { this.storageClassAnalysis = storageClassAnalysis != null ? storageClassAnalysis.build() : null; } @Override public AnalyticsConfiguration build() { return new AnalyticsConfiguration(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy