
com.amazonaws.services.lightsail.model.CacheBehaviorPerPath Maven / Gradle / Ivy
/*
* Copyright 2018-2023 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.lightsail.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Describes the per-path cache behavior of an Amazon Lightsail content delivery network (CDN) distribution.
*
*
* A per-path cache behavior is used to override, or add an exception to, the default cache behavior of a distribution.
* For example, if the cacheBehavior
is set to cache
, then a per-path cache behavior can be
* used to specify a directory, file, or file type that your distribution will cache. Alternately, if the distribution's
* cacheBehavior
is dont-cache
, then a per-path cache behavior can be used to specify a
* directory, file, or file type that your distribution will not cache.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CacheBehaviorPerPath implements Serializable, Cloneable, StructuredPojo {
/**
*
* The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard directories (
* path/to/assets/*
), and file types (*.html, *jpg, *js
). Directories and file paths are
* case-sensitive.
*
*
* Examples:
*
*
* -
*
* Specify the following to cache all files in the document root of an Apache web server running on a Lightsail
* instance.
*
*
* var/www/html/
*
*
* -
*
* Specify the following file to cache only the index page in the document root of an Apache web server.
*
*
* var/www/html/index.html
*
*
* -
*
* Specify the following to cache only the .html files in the document root of an Apache web server.
*
*
* var/www/html/*.html
*
*
* -
*
* Specify the following to cache only the .jpg, .png, and .gif files in the images sub-directory of the document
* root of an Apache web server.
*
*
* var/www/html/images/*.jpg
*
*
* var/www/html/images/*.png
*
*
* var/www/html/images/*.gif
*
*
* Specify the following to cache all files in the images sub-directory of the document root of an Apache web
* server.
*
*
* var/www/html/images/
*
*
*
*/
private String path;
/**
*
* The cache behavior for the specified path.
*
*
* You can specify one of the following per-path cache behaviors:
*
*
* -
*
* cache
- This behavior caches the specified path.
*
*
* -
*
* dont-cache
- This behavior doesn't cache the specified path.
*
*
*
*/
private String behavior;
/**
*
* The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard directories (
* path/to/assets/*
), and file types (*.html, *jpg, *js
). Directories and file paths are
* case-sensitive.
*
*
* Examples:
*
*
* -
*
* Specify the following to cache all files in the document root of an Apache web server running on a Lightsail
* instance.
*
*
* var/www/html/
*
*
* -
*
* Specify the following file to cache only the index page in the document root of an Apache web server.
*
*
* var/www/html/index.html
*
*
* -
*
* Specify the following to cache only the .html files in the document root of an Apache web server.
*
*
* var/www/html/*.html
*
*
* -
*
* Specify the following to cache only the .jpg, .png, and .gif files in the images sub-directory of the document
* root of an Apache web server.
*
*
* var/www/html/images/*.jpg
*
*
* var/www/html/images/*.png
*
*
* var/www/html/images/*.gif
*
*
* Specify the following to cache all files in the images sub-directory of the document root of an Apache web
* server.
*
*
* var/www/html/images/
*
*
*
*
* @param path
* The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard
* directories (path/to/assets/*
), and file types (*.html, *jpg, *js
). Directories
* and file paths are case-sensitive.
*
* Examples:
*
*
* -
*
* Specify the following to cache all files in the document root of an Apache web server running on a
* Lightsail instance.
*
*
* var/www/html/
*
*
* -
*
* Specify the following file to cache only the index page in the document root of an Apache web server.
*
*
* var/www/html/index.html
*
*
* -
*
* Specify the following to cache only the .html files in the document root of an Apache web server.
*
*
* var/www/html/*.html
*
*
* -
*
* Specify the following to cache only the .jpg, .png, and .gif files in the images sub-directory of the
* document root of an Apache web server.
*
*
* var/www/html/images/*.jpg
*
*
* var/www/html/images/*.png
*
*
* var/www/html/images/*.gif
*
*
* Specify the following to cache all files in the images sub-directory of the document root of an Apache web
* server.
*
*
* var/www/html/images/
*
*
*/
public void setPath(String path) {
this.path = path;
}
/**
*
* The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard directories (
* path/to/assets/*
), and file types (*.html, *jpg, *js
). Directories and file paths are
* case-sensitive.
*
*
* Examples:
*
*
* -
*
* Specify the following to cache all files in the document root of an Apache web server running on a Lightsail
* instance.
*
*
* var/www/html/
*
*
* -
*
* Specify the following file to cache only the index page in the document root of an Apache web server.
*
*
* var/www/html/index.html
*
*
* -
*
* Specify the following to cache only the .html files in the document root of an Apache web server.
*
*
* var/www/html/*.html
*
*
* -
*
* Specify the following to cache only the .jpg, .png, and .gif files in the images sub-directory of the document
* root of an Apache web server.
*
*
* var/www/html/images/*.jpg
*
*
* var/www/html/images/*.png
*
*
* var/www/html/images/*.gif
*
*
* Specify the following to cache all files in the images sub-directory of the document root of an Apache web
* server.
*
*
* var/www/html/images/
*
*
*
*
* @return The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard
* directories (path/to/assets/*
), and file types (*.html, *jpg, *js
). Directories
* and file paths are case-sensitive.
*
* Examples:
*
*
* -
*
* Specify the following to cache all files in the document root of an Apache web server running on a
* Lightsail instance.
*
*
* var/www/html/
*
*
* -
*
* Specify the following file to cache only the index page in the document root of an Apache web server.
*
*
* var/www/html/index.html
*
*
* -
*
* Specify the following to cache only the .html files in the document root of an Apache web server.
*
*
* var/www/html/*.html
*
*
* -
*
* Specify the following to cache only the .jpg, .png, and .gif files in the images sub-directory of the
* document root of an Apache web server.
*
*
* var/www/html/images/*.jpg
*
*
* var/www/html/images/*.png
*
*
* var/www/html/images/*.gif
*
*
* Specify the following to cache all files in the images sub-directory of the document root of an Apache
* web server.
*
*
* var/www/html/images/
*
*
*/
public String getPath() {
return this.path;
}
/**
*
* The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard directories (
* path/to/assets/*
), and file types (*.html, *jpg, *js
). Directories and file paths are
* case-sensitive.
*
*
* Examples:
*
*
* -
*
* Specify the following to cache all files in the document root of an Apache web server running on a Lightsail
* instance.
*
*
* var/www/html/
*
*
* -
*
* Specify the following file to cache only the index page in the document root of an Apache web server.
*
*
* var/www/html/index.html
*
*
* -
*
* Specify the following to cache only the .html files in the document root of an Apache web server.
*
*
* var/www/html/*.html
*
*
* -
*
* Specify the following to cache only the .jpg, .png, and .gif files in the images sub-directory of the document
* root of an Apache web server.
*
*
* var/www/html/images/*.jpg
*
*
* var/www/html/images/*.png
*
*
* var/www/html/images/*.gif
*
*
* Specify the following to cache all files in the images sub-directory of the document root of an Apache web
* server.
*
*
* var/www/html/images/
*
*
*
*
* @param path
* The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard
* directories (path/to/assets/*
), and file types (*.html, *jpg, *js
). Directories
* and file paths are case-sensitive.
*
* Examples:
*
*
* -
*
* Specify the following to cache all files in the document root of an Apache web server running on a
* Lightsail instance.
*
*
* var/www/html/
*
*
* -
*
* Specify the following file to cache only the index page in the document root of an Apache web server.
*
*
* var/www/html/index.html
*
*
* -
*
* Specify the following to cache only the .html files in the document root of an Apache web server.
*
*
* var/www/html/*.html
*
*
* -
*
* Specify the following to cache only the .jpg, .png, and .gif files in the images sub-directory of the
* document root of an Apache web server.
*
*
* var/www/html/images/*.jpg
*
*
* var/www/html/images/*.png
*
*
* var/www/html/images/*.gif
*
*
* Specify the following to cache all files in the images sub-directory of the document root of an Apache web
* server.
*
*
* var/www/html/images/
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CacheBehaviorPerPath withPath(String path) {
setPath(path);
return this;
}
/**
*
* The cache behavior for the specified path.
*
*
* You can specify one of the following per-path cache behaviors:
*
*
* -
*
* cache
- This behavior caches the specified path.
*
*
* -
*
* dont-cache
- This behavior doesn't cache the specified path.
*
*
*
*
* @param behavior
* The cache behavior for the specified path.
*
* You can specify one of the following per-path cache behaviors:
*
*
* -
*
* cache
- This behavior caches the specified path.
*
*
* -
*
* dont-cache
- This behavior doesn't cache the specified path.
*
*
* @see BehaviorEnum
*/
public void setBehavior(String behavior) {
this.behavior = behavior;
}
/**
*
* The cache behavior for the specified path.
*
*
* You can specify one of the following per-path cache behaviors:
*
*
* -
*
* cache
- This behavior caches the specified path.
*
*
* -
*
* dont-cache
- This behavior doesn't cache the specified path.
*
*
*
*
* @return The cache behavior for the specified path.
*
* You can specify one of the following per-path cache behaviors:
*
*
* -
*
* cache
- This behavior caches the specified path.
*
*
* -
*
* dont-cache
- This behavior doesn't cache the specified path.
*
*
* @see BehaviorEnum
*/
public String getBehavior() {
return this.behavior;
}
/**
*
* The cache behavior for the specified path.
*
*
* You can specify one of the following per-path cache behaviors:
*
*
* -
*
* cache
- This behavior caches the specified path.
*
*
* -
*
* dont-cache
- This behavior doesn't cache the specified path.
*
*
*
*
* @param behavior
* The cache behavior for the specified path.
*
* You can specify one of the following per-path cache behaviors:
*
*
* -
*
* cache
- This behavior caches the specified path.
*
*
* -
*
* dont-cache
- This behavior doesn't cache the specified path.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see BehaviorEnum
*/
public CacheBehaviorPerPath withBehavior(String behavior) {
setBehavior(behavior);
return this;
}
/**
*
* The cache behavior for the specified path.
*
*
* You can specify one of the following per-path cache behaviors:
*
*
* -
*
* cache
- This behavior caches the specified path.
*
*
* -
*
* dont-cache
- This behavior doesn't cache the specified path.
*
*
*
*
* @param behavior
* The cache behavior for the specified path.
*
* You can specify one of the following per-path cache behaviors:
*
*
* -
*
* cache
- This behavior caches the specified path.
*
*
* -
*
* dont-cache
- This behavior doesn't cache the specified path.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see BehaviorEnum
*/
public CacheBehaviorPerPath withBehavior(BehaviorEnum behavior) {
this.behavior = behavior.toString();
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 (getPath() != null)
sb.append("Path: ").append(getPath()).append(",");
if (getBehavior() != null)
sb.append("Behavior: ").append(getBehavior());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CacheBehaviorPerPath == false)
return false;
CacheBehaviorPerPath other = (CacheBehaviorPerPath) obj;
if (other.getPath() == null ^ this.getPath() == null)
return false;
if (other.getPath() != null && other.getPath().equals(this.getPath()) == false)
return false;
if (other.getBehavior() == null ^ this.getBehavior() == null)
return false;
if (other.getBehavior() != null && other.getBehavior().equals(this.getBehavior()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode());
hashCode = prime * hashCode + ((getBehavior() == null) ? 0 : getBehavior().hashCode());
return hashCode;
}
@Override
public CacheBehaviorPerPath clone() {
try {
return (CacheBehaviorPerPath) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.lightsail.model.transform.CacheBehaviorPerPathMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}