
software.amazon.awssdk.services.wafv2.model.VersionToPublish 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.wafv2.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;
/**
*
* A version of the named managed rule group, that the rule group's vendor publishes for use by customers.
*
*
*
* This is intended for use only by vendors of managed rule sets. Vendors are Amazon Web Services and Amazon Web
* Services Marketplace sellers.
*
*
* Vendors, you can use the managed rule set APIs to provide controlled rollout of your versioned managed rule group
* offerings for your customers. The APIs are ListManagedRuleSets
, GetManagedRuleSet
,
* PutManagedRuleSetVersions
, and UpdateManagedRuleSetVersionExpiryDate
.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class VersionToPublish implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ASSOCIATED_RULE_GROUP_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AssociatedRuleGroupArn").getter(getter(VersionToPublish::associatedRuleGroupArn))
.setter(setter(Builder::associatedRuleGroupArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssociatedRuleGroupArn").build())
.build();
private static final SdkField FORECASTED_LIFETIME_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("ForecastedLifetime").getter(getter(VersionToPublish::forecastedLifetime))
.setter(setter(Builder::forecastedLifetime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ForecastedLifetime").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
ASSOCIATED_RULE_GROUP_ARN_FIELD, FORECASTED_LIFETIME_FIELD));
private static final long serialVersionUID = 1L;
private final String associatedRuleGroupArn;
private final Integer forecastedLifetime;
private VersionToPublish(BuilderImpl builder) {
this.associatedRuleGroupArn = builder.associatedRuleGroupArn;
this.forecastedLifetime = builder.forecastedLifetime;
}
/**
*
* The Amazon Resource Name (ARN) of the vendor's rule group that's used in the published managed rule group
* version.
*
*
* @return The Amazon Resource Name (ARN) of the vendor's rule group that's used in the published managed rule group
* version.
*/
public final String associatedRuleGroupArn() {
return associatedRuleGroupArn;
}
/**
*
* The amount of time the vendor expects this version of the managed rule group to last, in days.
*
*
* @return The amount of time the vendor expects this version of the managed rule group to last, in days.
*/
public final Integer forecastedLifetime() {
return forecastedLifetime;
}
@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(associatedRuleGroupArn());
hashCode = 31 * hashCode + Objects.hashCode(forecastedLifetime());
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 VersionToPublish)) {
return false;
}
VersionToPublish other = (VersionToPublish) obj;
return Objects.equals(associatedRuleGroupArn(), other.associatedRuleGroupArn())
&& Objects.equals(forecastedLifetime(), other.forecastedLifetime());
}
/**
* 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("VersionToPublish").add("AssociatedRuleGroupArn", associatedRuleGroupArn())
.add("ForecastedLifetime", forecastedLifetime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AssociatedRuleGroupArn":
return Optional.ofNullable(clazz.cast(associatedRuleGroupArn()));
case "ForecastedLifetime":
return Optional.ofNullable(clazz.cast(forecastedLifetime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function