com.amazonaws.services.cloudfront.model.ResponseHeadersPolicyServerTimingHeadersConfig Maven / Gradle / Ivy
Show all versions of aws-java-sdk-cloudfront Show documentation
/*
* Copyright 2017-2022 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 com.amazonaws.services.cloudfront.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* A configuration for enabling the Server-Timing
header in HTTP responses sent from CloudFront. CloudFront
* adds this header to HTTP responses that it sends in response to requests that match a cache behavior that's
* associated with this response headers policy.
*
*
* You can use the Server-Timing
header to view metrics that can help you gain insights about the behavior
* and performance of CloudFront. For example, you can see which cache layer served a cache hit, or the first byte
* latency from the origin when there was a cache miss. You can use the metrics in the Server-Timing
header
* to troubleshoot issues or test the efficiency of your CloudFront configuration. For more information, see Server-Timing header in the Amazon CloudFront Developer Guide.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ResponseHeadersPolicyServerTimingHeadersConfig implements Serializable, Cloneable {
/**
*
* A Boolean that determines whether CloudFront adds the Server-Timing
header to HTTP responses that it
* sends in response to requests that match a cache behavior that's associated with this response headers policy.
*
*/
private Boolean enabled;
/**
*
* A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the
* Server-Timing
header to. When you set the sampling rate to 100, CloudFront adds the
* Server-Timing
header to the HTTP response for every request that matches the cache behavior that
* this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the
* responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up
* to four decimal places.
*
*/
private Double samplingRate;
/**
*
* A Boolean that determines whether CloudFront adds the Server-Timing
header to HTTP responses that it
* sends in response to requests that match a cache behavior that's associated with this response headers policy.
*
*
* @param enabled
* A Boolean that determines whether CloudFront adds the Server-Timing
header to HTTP responses
* that it sends in response to requests that match a cache behavior that's associated with this response
* headers policy.
*/
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
/**
*
* A Boolean that determines whether CloudFront adds the Server-Timing
header to HTTP responses that it
* sends in response to requests that match a cache behavior that's associated with this response headers policy.
*
*
* @return A Boolean that determines whether CloudFront adds the Server-Timing
header to HTTP responses
* that it sends in response to requests that match a cache behavior that's associated with this response
* headers policy.
*/
public Boolean getEnabled() {
return this.enabled;
}
/**
*
* A Boolean that determines whether CloudFront adds the Server-Timing
header to HTTP responses that it
* sends in response to requests that match a cache behavior that's associated with this response headers policy.
*
*
* @param enabled
* A Boolean that determines whether CloudFront adds the Server-Timing
header to HTTP responses
* that it sends in response to requests that match a cache behavior that's associated with this response
* headers policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResponseHeadersPolicyServerTimingHeadersConfig withEnabled(Boolean enabled) {
setEnabled(enabled);
return this;
}
/**
*
* A Boolean that determines whether CloudFront adds the Server-Timing
header to HTTP responses that it
* sends in response to requests that match a cache behavior that's associated with this response headers policy.
*
*
* @return A Boolean that determines whether CloudFront adds the Server-Timing
header to HTTP responses
* that it sends in response to requests that match a cache behavior that's associated with this response
* headers policy.
*/
public Boolean isEnabled() {
return this.enabled;
}
/**
*
* A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the
* Server-Timing
header to. When you set the sampling rate to 100, CloudFront adds the
* Server-Timing
header to the HTTP response for every request that matches the cache behavior that
* this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the
* responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up
* to four decimal places.
*
*
* @param samplingRate
* A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the
* Server-Timing
header to. When you set the sampling rate to 100, CloudFront adds the
* Server-Timing
header to the HTTP response for every request that matches the cache behavior
* that this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50%
* of the responses for requests that match the cache behavior. You can set the sampling rate to any number
* 0–100 with up to four decimal places.
*/
public void setSamplingRate(Double samplingRate) {
this.samplingRate = samplingRate;
}
/**
*
* A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the
* Server-Timing
header to. When you set the sampling rate to 100, CloudFront adds the
* Server-Timing
header to the HTTP response for every request that matches the cache behavior that
* this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the
* responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up
* to four decimal places.
*
*
* @return A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the
* Server-Timing
header to. When you set the sampling rate to 100, CloudFront adds the
* Server-Timing
header to the HTTP response for every request that matches the cache behavior
* that this response headers policy is attached to. When you set it to 50, CloudFront adds the header to
* 50% of the responses for requests that match the cache behavior. You can set the sampling rate to any
* number 0–100 with up to four decimal places.
*/
public Double getSamplingRate() {
return this.samplingRate;
}
/**
*
* A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the
* Server-Timing
header to. When you set the sampling rate to 100, CloudFront adds the
* Server-Timing
header to the HTTP response for every request that matches the cache behavior that
* this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the
* responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up
* to four decimal places.
*
*
* @param samplingRate
* A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the
* Server-Timing
header to. When you set the sampling rate to 100, CloudFront adds the
* Server-Timing
header to the HTTP response for every request that matches the cache behavior
* that this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50%
* of the responses for requests that match the cache behavior. You can set the sampling rate to any number
* 0–100 with up to four decimal places.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResponseHeadersPolicyServerTimingHeadersConfig withSamplingRate(Double samplingRate) {
setSamplingRate(samplingRate);
return this;
}
/**
* 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.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getEnabled() != null)
sb.append("Enabled: ").append(getEnabled()).append(",");
if (getSamplingRate() != null)
sb.append("SamplingRate: ").append(getSamplingRate());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ResponseHeadersPolicyServerTimingHeadersConfig == false)
return false;
ResponseHeadersPolicyServerTimingHeadersConfig other = (ResponseHeadersPolicyServerTimingHeadersConfig) obj;
if (other.getEnabled() == null ^ this.getEnabled() == null)
return false;
if (other.getEnabled() != null && other.getEnabled().equals(this.getEnabled()) == false)
return false;
if (other.getSamplingRate() == null ^ this.getSamplingRate() == null)
return false;
if (other.getSamplingRate() != null && other.getSamplingRate().equals(this.getSamplingRate()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getEnabled() == null) ? 0 : getEnabled().hashCode());
hashCode = prime * hashCode + ((getSamplingRate() == null) ? 0 : getSamplingRate().hashCode());
return hashCode;
}
@Override
public ResponseHeadersPolicyServerTimingHeadersConfig clone() {
try {
return (ResponseHeadersPolicyServerTimingHeadersConfig) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}