software.amazon.awssdk.services.cloudfront.model.OriginAccessControlSummary Maven / Gradle / Ivy
Show all versions of cloudfront Show documentation
/*
* 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.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 CloudFront origin access control.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class OriginAccessControlSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("Id")
.getter(getter(OriginAccessControlSummary::id))
.setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").unmarshallLocationName("Id")
.build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("Description")
.getter(getter(OriginAccessControlSummary::description))
.setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description")
.unmarshallLocationName("Description").build()).build();
private static final SdkField NAME_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("Name")
.getter(getter(OriginAccessControlSummary::name))
.setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name")
.unmarshallLocationName("Name").build()).build();
private static final SdkField SIGNING_PROTOCOL_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("SigningProtocol")
.getter(getter(OriginAccessControlSummary::signingProtocolAsString))
.setter(setter(Builder::signingProtocol))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SigningProtocol")
.unmarshallLocationName("SigningProtocol").build()).build();
private static final SdkField SIGNING_BEHAVIOR_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("SigningBehavior")
.getter(getter(OriginAccessControlSummary::signingBehaviorAsString))
.setter(setter(Builder::signingBehavior))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SigningBehavior")
.unmarshallLocationName("SigningBehavior").build()).build();
private static final SdkField ORIGIN_ACCESS_CONTROL_ORIGIN_TYPE_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("OriginAccessControlOriginType")
.getter(getter(OriginAccessControlSummary::originAccessControlOriginTypeAsString))
.setter(setter(Builder::originAccessControlOriginType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OriginAccessControlOriginType")
.unmarshallLocationName("OriginAccessControlOriginType").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, DESCRIPTION_FIELD,
NAME_FIELD, SIGNING_PROTOCOL_FIELD, SIGNING_BEHAVIOR_FIELD, ORIGIN_ACCESS_CONTROL_ORIGIN_TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final String id;
private final String description;
private final String name;
private final String signingProtocol;
private final String signingBehavior;
private final String originAccessControlOriginType;
private OriginAccessControlSummary(BuilderImpl builder) {
this.id = builder.id;
this.description = builder.description;
this.name = builder.name;
this.signingProtocol = builder.signingProtocol;
this.signingBehavior = builder.signingBehavior;
this.originAccessControlOriginType = builder.originAccessControlOriginType;
}
/**
*
* The unique identifier of the origin access control.
*
*
* @return The unique identifier of the origin access control.
*/
public final String id() {
return id;
}
/**
*
* A description of the origin access control.
*
*
* @return A description of the origin access control.
*/
public final String description() {
return description;
}
/**
*
* A unique name that identifies the origin access control.
*
*
* @return A unique name that identifies the origin access control.
*/
public final String name() {
return name;
}
/**
*
* The signing protocol of the origin access control. The signing protocol determines how CloudFront signs
* (authenticates) requests. The only valid value is sigv4
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #signingProtocol}
* will return {@link OriginAccessControlSigningProtocols#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the
* service is available from {@link #signingProtocolAsString}.
*
*
* @return The signing protocol of the origin access control. The signing protocol determines how CloudFront signs
* (authenticates) requests. The only valid value is sigv4
.
* @see OriginAccessControlSigningProtocols
*/
public final OriginAccessControlSigningProtocols signingProtocol() {
return OriginAccessControlSigningProtocols.fromValue(signingProtocol);
}
/**
*
* The signing protocol of the origin access control. The signing protocol determines how CloudFront signs
* (authenticates) requests. The only valid value is sigv4
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #signingProtocol}
* will return {@link OriginAccessControlSigningProtocols#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the
* service is available from {@link #signingProtocolAsString}.
*
*
* @return The signing protocol of the origin access control. The signing protocol determines how CloudFront signs
* (authenticates) requests. The only valid value is sigv4
.
* @see OriginAccessControlSigningProtocols
*/
public final String signingProtocolAsString() {
return signingProtocol;
}
/**
*
* A value that specifies which requests CloudFront signs (adds authentication information to). This field can have
* one of the following values:
*
*
* -
*
* never
– CloudFront doesn't sign any origin requests.
*
*
* -
*
* always
– CloudFront signs all origin requests, overwriting the Authorization
header
* from the viewer request if necessary.
*
*
* -
*
* no-override
– If the viewer request doesn't contain the Authorization
header,
* CloudFront signs the origin request. If the viewer request contains the Authorization
header,
* CloudFront doesn't sign the origin request, but instead passes along the Authorization
header that
* it received in the viewer request.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #signingBehavior}
* will return {@link OriginAccessControlSigningBehaviors#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the
* service is available from {@link #signingBehaviorAsString}.
*
*
* @return A value that specifies which requests CloudFront signs (adds authentication information to). This field
* can have one of the following values:
*
* -
*
* never
– CloudFront doesn't sign any origin requests.
*
*
* -
*
* always
– CloudFront signs all origin requests, overwriting the Authorization
* header from the viewer request if necessary.
*
*
* -
*
* no-override
– If the viewer request doesn't contain the Authorization
header,
* CloudFront signs the origin request. If the viewer request contains the Authorization
* header, CloudFront doesn't sign the origin request, but instead passes along the
* Authorization
header that it received in the viewer request.
*
*
* @see OriginAccessControlSigningBehaviors
*/
public final OriginAccessControlSigningBehaviors signingBehavior() {
return OriginAccessControlSigningBehaviors.fromValue(signingBehavior);
}
/**
*
* A value that specifies which requests CloudFront signs (adds authentication information to). This field can have
* one of the following values:
*
*
* -
*
* never
– CloudFront doesn't sign any origin requests.
*
*
* -
*
* always
– CloudFront signs all origin requests, overwriting the Authorization
header
* from the viewer request if necessary.
*
*
* -
*
* no-override
– If the viewer request doesn't contain the Authorization
header,
* CloudFront signs the origin request. If the viewer request contains the Authorization
header,
* CloudFront doesn't sign the origin request, but instead passes along the Authorization
header that
* it received in the viewer request.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #signingBehavior}
* will return {@link OriginAccessControlSigningBehaviors#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the
* service is available from {@link #signingBehaviorAsString}.
*
*
* @return A value that specifies which requests CloudFront signs (adds authentication information to). This field
* can have one of the following values:
*
* -
*
* never
– CloudFront doesn't sign any origin requests.
*
*
* -
*
* always
– CloudFront signs all origin requests, overwriting the Authorization
* header from the viewer request if necessary.
*
*
* -
*
* no-override
– If the viewer request doesn't contain the Authorization
header,
* CloudFront signs the origin request. If the viewer request contains the Authorization
* header, CloudFront doesn't sign the origin request, but instead passes along the
* Authorization
header that it received in the viewer request.
*
*
* @see OriginAccessControlSigningBehaviors
*/
public final String signingBehaviorAsString() {
return signingBehavior;
}
/**
*
* The type of origin that this origin access control is for.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #originAccessControlOriginType} will return {@link OriginAccessControlOriginTypes#UNKNOWN_TO_SDK_VERSION}.
* The raw value returned by the service is available from {@link #originAccessControlOriginTypeAsString}.
*
*
* @return The type of origin that this origin access control is for.
* @see OriginAccessControlOriginTypes
*/
public final OriginAccessControlOriginTypes originAccessControlOriginType() {
return OriginAccessControlOriginTypes.fromValue(originAccessControlOriginType);
}
/**
*
* The type of origin that this origin access control is for.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #originAccessControlOriginType} will return {@link OriginAccessControlOriginTypes#UNKNOWN_TO_SDK_VERSION}.
* The raw value returned by the service is available from {@link #originAccessControlOriginTypeAsString}.
*
*
* @return The type of origin that this origin access control is for.
* @see OriginAccessControlOriginTypes
*/
public final String originAccessControlOriginTypeAsString() {
return originAccessControlOriginType;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(signingProtocolAsString());
hashCode = 31 * hashCode + Objects.hashCode(signingBehaviorAsString());
hashCode = 31 * hashCode + Objects.hashCode(originAccessControlOriginTypeAsString());
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 OriginAccessControlSummary)) {
return false;
}
OriginAccessControlSummary other = (OriginAccessControlSummary) obj;
return Objects.equals(id(), other.id()) && Objects.equals(description(), other.description())
&& Objects.equals(name(), other.name())
&& Objects.equals(signingProtocolAsString(), other.signingProtocolAsString())
&& Objects.equals(signingBehaviorAsString(), other.signingBehaviorAsString())
&& Objects.equals(originAccessControlOriginTypeAsString(), other.originAccessControlOriginTypeAsString());
}
/**
* 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("OriginAccessControlSummary").add("Id", id()).add("Description", description())
.add("Name", name()).add("SigningProtocol", signingProtocolAsString())
.add("SigningBehavior", signingBehaviorAsString())
.add("OriginAccessControlOriginType", originAccessControlOriginTypeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "SigningProtocol":
return Optional.ofNullable(clazz.cast(signingProtocolAsString()));
case "SigningBehavior":
return Optional.ofNullable(clazz.cast(signingBehaviorAsString()));
case "OriginAccessControlOriginType":
return Optional.ofNullable(clazz.cast(originAccessControlOriginTypeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function