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

software.amazon.awssdk.services.waf.model.LoggingConfiguration Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS WAF Service module holds the client classes that are used for communicating with AWS WAF Service

There is a newer version: 2.29.15
Show newest version
/*
 * 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.waf.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;

/**
 * 
 * 

* This is AWS WAF Classic documentation. For more information, see AWS WAF Classic in the * developer guide. *

*

* For the latest version of AWS WAF, use the AWS WAFV2 API and see the AWS WAF Developer Guide. With the * latest version, AWS WAF has a single set of endpoints for regional and global use. *

*
*

* The Amazon Kinesis Data Firehose, RedactedFields information, and the web ACL Amazon Resource Name * (ARN). *

*/ @Generated("software.amazon.awssdk:codegen") public final class LoggingConfiguration implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField RESOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ResourceArn").getter(getter(LoggingConfiguration::resourceArn)).setter(setter(Builder::resourceArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceArn").build()).build(); private static final SdkField> LOG_DESTINATION_CONFIGS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("LogDestinationConfigs") .getter(getter(LoggingConfiguration::logDestinationConfigs)) .setter(setter(Builder::logDestinationConfigs)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogDestinationConfigs").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> REDACTED_FIELDS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("RedactedFields") .getter(getter(LoggingConfiguration::redactedFields)) .setter(setter(Builder::redactedFields)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RedactedFields").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(FieldToMatch::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RESOURCE_ARN_FIELD, LOG_DESTINATION_CONFIGS_FIELD, REDACTED_FIELDS_FIELD)); private static final long serialVersionUID = 1L; private final String resourceArn; private final List logDestinationConfigs; private final List redactedFields; private LoggingConfiguration(BuilderImpl builder) { this.resourceArn = builder.resourceArn; this.logDestinationConfigs = builder.logDestinationConfigs; this.redactedFields = builder.redactedFields; } /** *

* The Amazon Resource Name (ARN) of the web ACL that you want to associate with LogDestinationConfigs. *

* * @return The Amazon Resource Name (ARN) of the web ACL that you want to associate with * LogDestinationConfigs. */ public final String resourceArn() { return resourceArn; } /** * For responses, this returns true if the service returned a value for the LogDestinationConfigs 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 hasLogDestinationConfigs() { return logDestinationConfigs != null && !(logDestinationConfigs instanceof SdkAutoConstructList); } /** *

* An array of Amazon Kinesis Data Firehose ARNs. *

*

* 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 #hasLogDestinationConfigs} method. *

* * @return An array of Amazon Kinesis Data Firehose ARNs. */ public final List logDestinationConfigs() { return logDestinationConfigs; } /** * For responses, this returns true if the service returned a value for the RedactedFields 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 hasRedactedFields() { return redactedFields != null && !(redactedFields instanceof SdkAutoConstructList); } /** *

* The parts of the request that you want redacted from the logs. For example, if you redact the cookie field, the * cookie field in the firehose will be xxx. *

*

* 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 #hasRedactedFields} method. *

* * @return The parts of the request that you want redacted from the logs. For example, if you redact the cookie * field, the cookie field in the firehose will be xxx. */ public final List redactedFields() { return redactedFields; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(resourceArn()); hashCode = 31 * hashCode + Objects.hashCode(hasLogDestinationConfigs() ? logDestinationConfigs() : null); hashCode = 31 * hashCode + Objects.hashCode(hasRedactedFields() ? redactedFields() : null); 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 LoggingConfiguration)) { return false; } LoggingConfiguration other = (LoggingConfiguration) obj; return Objects.equals(resourceArn(), other.resourceArn()) && hasLogDestinationConfigs() == other.hasLogDestinationConfigs() && Objects.equals(logDestinationConfigs(), other.logDestinationConfigs()) && hasRedactedFields() == other.hasRedactedFields() && Objects.equals(redactedFields(), other.redactedFields()); } /** * 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("LoggingConfiguration").add("ResourceArn", resourceArn()) .add("LogDestinationConfigs", hasLogDestinationConfigs() ? logDestinationConfigs() : null) .add("RedactedFields", hasRedactedFields() ? redactedFields() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ResourceArn": return Optional.ofNullable(clazz.cast(resourceArn())); case "LogDestinationConfigs": return Optional.ofNullable(clazz.cast(logDestinationConfigs())); case "RedactedFields": return Optional.ofNullable(clazz.cast(redactedFields())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((LoggingConfiguration) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) of the web ACL that you want to associate with * LogDestinationConfigs. *

* * @param resourceArn * The Amazon Resource Name (ARN) of the web ACL that you want to associate with * LogDestinationConfigs. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceArn(String resourceArn); /** *

* An array of Amazon Kinesis Data Firehose ARNs. *

* * @param logDestinationConfigs * An array of Amazon Kinesis Data Firehose ARNs. * @return Returns a reference to this object so that method calls can be chained together. */ Builder logDestinationConfigs(Collection logDestinationConfigs); /** *

* An array of Amazon Kinesis Data Firehose ARNs. *

* * @param logDestinationConfigs * An array of Amazon Kinesis Data Firehose ARNs. * @return Returns a reference to this object so that method calls can be chained together. */ Builder logDestinationConfigs(String... logDestinationConfigs); /** *

* The parts of the request that you want redacted from the logs. For example, if you redact the cookie field, * the cookie field in the firehose will be xxx. *

* * @param redactedFields * The parts of the request that you want redacted from the logs. For example, if you redact the cookie * field, the cookie field in the firehose will be xxx. * @return Returns a reference to this object so that method calls can be chained together. */ Builder redactedFields(Collection redactedFields); /** *

* The parts of the request that you want redacted from the logs. For example, if you redact the cookie field, * the cookie field in the firehose will be xxx. *

* * @param redactedFields * The parts of the request that you want redacted from the logs. For example, if you redact the cookie * field, the cookie field in the firehose will be xxx. * @return Returns a reference to this object so that method calls can be chained together. */ Builder redactedFields(FieldToMatch... redactedFields); /** *

* The parts of the request that you want redacted from the logs. For example, if you redact the cookie field, * the cookie field in the firehose will be xxx. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.waf.model.FieldToMatch.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.waf.model.FieldToMatch#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.waf.model.FieldToMatch.Builder#build()} is called immediately and its * result is passed to {@link #redactedFields(List)}. * * @param redactedFields * a consumer that will call methods on * {@link software.amazon.awssdk.services.waf.model.FieldToMatch.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #redactedFields(java.util.Collection) */ Builder redactedFields(Consumer... redactedFields); } static final class BuilderImpl implements Builder { private String resourceArn; private List logDestinationConfigs = DefaultSdkAutoConstructList.getInstance(); private List redactedFields = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(LoggingConfiguration model) { resourceArn(model.resourceArn); logDestinationConfigs(model.logDestinationConfigs); redactedFields(model.redactedFields); } public final String getResourceArn() { return resourceArn; } public final void setResourceArn(String resourceArn) { this.resourceArn = resourceArn; } @Override public final Builder resourceArn(String resourceArn) { this.resourceArn = resourceArn; return this; } public final Collection getLogDestinationConfigs() { if (logDestinationConfigs instanceof SdkAutoConstructList) { return null; } return logDestinationConfigs; } public final void setLogDestinationConfigs(Collection logDestinationConfigs) { this.logDestinationConfigs = LogDestinationConfigsCopier.copy(logDestinationConfigs); } @Override public final Builder logDestinationConfigs(Collection logDestinationConfigs) { this.logDestinationConfigs = LogDestinationConfigsCopier.copy(logDestinationConfigs); return this; } @Override @SafeVarargs public final Builder logDestinationConfigs(String... logDestinationConfigs) { logDestinationConfigs(Arrays.asList(logDestinationConfigs)); return this; } public final List getRedactedFields() { List result = RedactedFieldsCopier.copyToBuilder(this.redactedFields); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setRedactedFields(Collection redactedFields) { this.redactedFields = RedactedFieldsCopier.copyFromBuilder(redactedFields); } @Override public final Builder redactedFields(Collection redactedFields) { this.redactedFields = RedactedFieldsCopier.copy(redactedFields); return this; } @Override @SafeVarargs public final Builder redactedFields(FieldToMatch... redactedFields) { redactedFields(Arrays.asList(redactedFields)); return this; } @Override @SafeVarargs public final Builder redactedFields(Consumer... redactedFields) { redactedFields(Stream.of(redactedFields).map(c -> FieldToMatch.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } @Override public LoggingConfiguration build() { return new LoggingConfiguration(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy