
software.amazon.awssdk.services.cloudfront.model.InvalidationBatch 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.cloudfront.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;
/**
*
* An invalidation batch.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class InvalidationBatch implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField PATHS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.getter(getter(InvalidationBatch::paths))
.setter(setter(Builder::paths))
.constructor(Paths::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Paths")
.unmarshallLocationName("Paths").build()).build();
private static final SdkField CALLER_REFERENCE_FIELD = SdkField
. builder(MarshallingType.STRING)
.getter(getter(InvalidationBatch::callerReference))
.setter(setter(Builder::callerReference))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CallerReference")
.unmarshallLocationName("CallerReference").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PATHS_FIELD,
CALLER_REFERENCE_FIELD));
private static final long serialVersionUID = 1L;
private final Paths paths;
private final String callerReference;
private InvalidationBatch(BuilderImpl builder) {
this.paths = builder.paths;
this.callerReference = builder.callerReference;
}
/**
*
* A complex type that contains information about the objects that you want to invalidate. For more information, see
* Specifying the Objects to Invalidate in the Amazon CloudFront Developer Guide.
*
*
* @return A complex type that contains information about the objects that you want to invalidate. For more
* information, see Specifying the Objects to Invalidate in the Amazon CloudFront Developer Guide.
*/
public Paths paths() {
return paths;
}
/**
*
* A value that you specify to uniquely identify an invalidation request. CloudFront uses the value to prevent you
* from accidentally resubmitting an identical request. Whenever you create a new invalidation request, you must
* specify a new value for CallerReference
and change other values in the request as applicable. One
* way to ensure that the value of CallerReference
is unique is to use a timestamp
, for
* example, 20120301090000
.
*
*
* If you make a second invalidation request with the same value for CallerReference
, and if the rest
* of the request is the same, CloudFront doesn't create a new invalidation request. Instead, CloudFront returns
* information about the invalidation request that you previously created with the same CallerReference
* .
*
*
* If CallerReference
is a value you already sent in a previous invalidation batch request but the
* content of any Path
is different from the original request, CloudFront returns an
* InvalidationBatchAlreadyExists
error.
*
*
* @return A value that you specify to uniquely identify an invalidation request. CloudFront uses the value to
* prevent you from accidentally resubmitting an identical request. Whenever you create a new invalidation
* request, you must specify a new value for CallerReference
and change other values in the
* request as applicable. One way to ensure that the value of CallerReference
is unique is to
* use a timestamp
, for example, 20120301090000
.
*
* If you make a second invalidation request with the same value for CallerReference
, and if
* the rest of the request is the same, CloudFront doesn't create a new invalidation request. Instead,
* CloudFront returns information about the invalidation request that you previously created with the same
* CallerReference
.
*
*
* If CallerReference
is a value you already sent in a previous invalidation batch request but
* the content of any Path
is different from the original request, CloudFront returns an
* InvalidationBatchAlreadyExists
error.
*/
public String callerReference() {
return callerReference;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(paths());
hashCode = 31 * hashCode + Objects.hashCode(callerReference());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof InvalidationBatch)) {
return false;
}
InvalidationBatch other = (InvalidationBatch) obj;
return Objects.equals(paths(), other.paths()) && Objects.equals(callerReference(), other.callerReference());
}
/**
* 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("InvalidationBatch").add("Paths", paths()).add("CallerReference", callerReference()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Paths":
return Optional.ofNullable(clazz.cast(paths()));
case "CallerReference":
return Optional.ofNullable(clazz.cast(callerReference()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* If you make a second invalidation request with the same value for CallerReference
, and if
* the rest of the request is the same, CloudFront doesn't create a new invalidation request. Instead,
* CloudFront returns information about the invalidation request that you previously created with the
* same CallerReference
.
*
*
* If CallerReference
is a value you already sent in a previous invalidation batch request
* but the content of any Path
is different from the original request, CloudFront returns an
* InvalidationBatchAlreadyExists
error.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder callerReference(String callerReference);
}
static final class BuilderImpl implements Builder {
private Paths paths;
private String callerReference;
private BuilderImpl() {
}
private BuilderImpl(InvalidationBatch model) {
paths(model.paths);
callerReference(model.callerReference);
}
public final Paths.Builder getPaths() {
return paths != null ? paths.toBuilder() : null;
}
@Override
public final Builder paths(Paths paths) {
this.paths = paths;
return this;
}
public final void setPaths(Paths.BuilderImpl paths) {
this.paths = paths != null ? paths.build() : null;
}
public final String getCallerReference() {
return callerReference;
}
@Override
public final Builder callerReference(String callerReference) {
this.callerReference = callerReference;
return this;
}
public final void setCallerReference(String callerReference) {
this.callerReference = callerReference;
}
@Override
public InvalidationBatch build() {
return new InvalidationBatch(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}