- Home
- API Enriched
- Cdn
- config
- Create CDN cache rule.
Create CDN cache rule.
const url = 'https://example-corp.console.ves.volterra.io/api/v1/api/production/us-east-1/namespaces/default/api/config/namespaces/example/cdn_cache_rules';const options = { method: 'POST', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"metadata":{"annotations":{},"description":"example","disable":true,"labels":{},"name":"example","namespace":"example"},"spec":{"cache_rules":{"cache_bypass":{},"eligible_for_cache":{"scheme_proxy_host_request_uri":{"cache_override":true,"cache_ttl":"example","ignore_response_cookie":true},"scheme_proxy_host_uri":{"cache_override":true,"cache_ttl":"example","ignore_response_cookie":true}},"rule_expression_list":[{"cache_rule_expression":[{"cache_headers":[{"name":"PROXY_HOST","operator":{"Contains":"example","DoesNotContain":"example","DoesNotEndWith":"example","DoesNotEqual":"example","DoesNotStartWith":"example","Endswith":"example","Equals":"example","MatchRegex":"example","Startswith":"example"}}],"cookie_matcher":[{"name":"example","operator":{"Contains":"example","DoesNotContain":"example","DoesNotEndWith":"example","DoesNotEqual":"example","DoesNotStartWith":"example","Endswith":"example","Equals":"example","MatchRegex":"example","Startswith":"example"}}],"path_match":{"operator":{"Contains":"example","DoesNotContain":"example","DoesNotEndWith":"example","DoesNotEqual":"example","DoesNotStartWith":"example","Endswith":"example","Equals":"example","MatchRegex":"example","Startswith":"example"}},"query_parameters":[{"key":"example","operator":{"Contains":"example","DoesNotContain":"example","DoesNotEndWith":"example","DoesNotEqual":"example","DoesNotStartWith":"example","Endswith":"example","Equals":"example","MatchRegex":"example","Startswith":"example"}}]}],"expression_name":"example"}],"rule_name":"example"}}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example-corp.console.ves.volterra.io/api/v1/api/production/us-east-1/namespaces/default/api/config/namespaces/example/cdn_cache_rules \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --data '{ "metadata": { "annotations": {}, "description": "example", "disable": true, "labels": {}, "name": "example", "namespace": "example" }, "spec": { "cache_rules": { "cache_bypass": {}, "eligible_for_cache": { "scheme_proxy_host_request_uri": { "cache_override": true, "cache_ttl": "example", "ignore_response_cookie": true }, "scheme_proxy_host_uri": { "cache_override": true, "cache_ttl": "example", "ignore_response_cookie": true } }, "rule_expression_list": [ { "cache_rule_expression": [ { "cache_headers": [ { "name": "PROXY_HOST", "operator": { "Contains": "example", "DoesNotContain": "example", "DoesNotEndWith": "example", "DoesNotEqual": "example", "DoesNotStartWith": "example", "Endswith": "example", "Equals": "example", "MatchRegex": "example", "Startswith": "example" } } ], "cookie_matcher": [ { "name": "example", "operator": { "Contains": "example", "DoesNotContain": "example", "DoesNotEndWith": "example", "DoesNotEqual": "example", "DoesNotStartWith": "example", "Endswith": "example", "Equals": "example", "MatchRegex": "example", "Startswith": "example" } } ], "path_match": { "operator": { "Contains": "example", "DoesNotContain": "example", "DoesNotEndWith": "example", "DoesNotEqual": "example", "DoesNotStartWith": "example", "Endswith": "example", "Equals": "example", "MatchRegex": "example", "Startswith": "example" } }, "query_parameters": [ { "key": "example", "operator": { "Contains": "example", "DoesNotContain": "example", "DoesNotEndWith": "example", "DoesNotEqual": "example", "DoesNotStartWith": "example", "Endswith": "example", "Equals": "example", "MatchRegex": "example", "Startswith": "example" } } ] } ], "expression_name": "example" } ], "rule_name": "example" } } }'Shape of the CDN loadbalancer specification.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Namespace This defines the workspace within which each the configuration object is to be created. Must be a DNS_LABEL format. For a namespace object itself, namespace value will be ""
Request Bodyrequired
Section titled “Request Bodyrequired”This is the input message of the ‘Create’ RPC.
object
object
Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects.
object
Human readable description for the object.
A value of true will administratively disable the object.
Map of string keys and values that can be used to organize and categorize (scope and select) objects as chosen by the user. Values specified here will be used by selector expression.
object
This is the name of configuration object. It has to be unique within the namespace. It can only be specified during create API and cannot be changed during replace API. The value of name has to follow DNS-1035 format. Required: YES.
This defines the workspace within which each the configuration object is to be created. Must be a DNS_LABEL format. For a namespace object itself, namespace value will be ""
object
object
object
object
object
Honour Cache Override.
Cache TTL value is used to cache the resource/content for the specified amount of time Format: [0-9][smhd], where s - seconds, m - minutes, h - hours, d - days Required: YES.
By default, response will not be cached if set-cookie header is present. This option will override the behavior and cache response even with set-cookie header present.
object
Honour Cache Override.
Cache TTL value is used to cache the resource/content for the specified amount of time Format: [0-9][smhd], where s - seconds, m - minutes, h - hours, d - days Required: YES.
By default, response will not be cached if set-cookie header is present. This option will override the behavior and cache response even with set-cookie header present.
Expressions are evaluated in the order in which they are specified. The evaluation stops when the first rule match occurs..
Required: YES.
CDN Cache Rule Expressions.
object
The Cache Rule Expression Terms that are ANDed
Required: YES.
Select one of the field OPTIONS.
object
Configure cache rule headers to match the criteria.
Header match is done using the name of the header and its value. The value match is done using one of the following regex match on value exact match of value presence of header
Header Match can also be inverse of above, which be used to check missing header or non-matching value.
object
object
Exclusive with [DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must contain.
Exclusive with [Contains DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not contain.
Exclusive with [Contains DoesNotContain DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not equal.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual Endswith Equals MatchRegex Startswith] Field must not start with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Equals MatchRegex Startswith] Field must end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith MatchRegex Startswith] Field must exactly match.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals Startswith] Field matches PCRE 1 compliant regular expression.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex] Field must start with.
A list of predicates for all cookies that need to be matched. The criteria for matching each cookie is described in individual instances of CookieMatcherType. The actual cookie values are extracted from the request API as a list of strings for each cookie name. Note that all specified cookie matcher predicates must evaluate to true.
A cookie matcher specifies the name of a single cookie and the criteria to match it. The input has a list of values for each cookie in the request. A cookie matcher can check for one of the following:
- Presence or absence of the cookie
- At least one of the values for the cookie in the request satisfies the MatcherType item.
object
A case-sensitive cookie name. Required: YES.
object
Exclusive with [DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must contain.
Exclusive with [Contains DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not contain.
Exclusive with [Contains DoesNotContain DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not equal.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual Endswith Equals MatchRegex Startswith] Field must not start with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Equals MatchRegex Startswith] Field must end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith MatchRegex Startswith] Field must exactly match.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals Startswith] Field matches PCRE 1 compliant regular expression.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex] Field must start with.
object
object
Exclusive with [DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must contain.
Exclusive with [Contains DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not contain.
Exclusive with [Contains DoesNotContain DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not equal.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual Endswith Equals MatchRegex Startswith] Field must not start with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Equals MatchRegex Startswith] Field must end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith MatchRegex Startswith] Field must exactly match.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals Startswith] Field matches PCRE 1 compliant regular expression.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex] Field must start with.
List of (key, value) query parameters.
Query parameter match can be either regex match on value or exact match of value for given key An example for HTTP request with query parameter https://gitlab.com/dashboard/issues?assignee_username=xxyyxx.
object
Query parameter key In the above example, assignee_username is the key Required: YES.
object
Exclusive with [DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must contain.
Exclusive with [Contains DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not contain.
Exclusive with [Contains DoesNotContain DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not equal.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual Endswith Equals MatchRegex Startswith] Field must not start with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Equals MatchRegex Startswith] Field must end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith MatchRegex Startswith] Field must exactly match.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals Startswith] Field matches PCRE 1 compliant regular expression.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex] Field must start with.
Name of the Expressions items that are ANDed Required: YES.
Name of the Cache Rule Required: YES.
Responses
Section titled “Responses”A successful response.
object
object
Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects.
object
Human readable description for the object.
A value of true will administratively disable the object.
Map of string keys and values that can be used to organize and categorize (scope and select) objects as chosen by the user. Values specified here will be used by selector expression.
object
This is the name of configuration object. It has to be unique within the namespace. It can only be specified during create API and cannot be changed during replace API. The value of name has to follow DNS-1035 format. Required: YES.
This defines the workspace within which each the configuration object is to be created. Must be a DNS_LABEL format. For a namespace object itself, namespace value will be ""
object
object
object
object
object
Honour Cache Override.
Cache TTL value is used to cache the resource/content for the specified amount of time Format: [0-9][smhd], where s - seconds, m - minutes, h - hours, d - days Required: YES.
By default, response will not be cached if set-cookie header is present. This option will override the behavior and cache response even with set-cookie header present.
object
Honour Cache Override.
Cache TTL value is used to cache the resource/content for the specified amount of time Format: [0-9][smhd], where s - seconds, m - minutes, h - hours, d - days Required: YES.
By default, response will not be cached if set-cookie header is present. This option will override the behavior and cache response even with set-cookie header present.
Expressions are evaluated in the order in which they are specified. The evaluation stops when the first rule match occurs..
Required: YES.
CDN Cache Rule Expressions.
object
The Cache Rule Expression Terms that are ANDed
Required: YES.
Select one of the field OPTIONS.
object
Configure cache rule headers to match the criteria.
Header match is done using the name of the header and its value. The value match is done using one of the following regex match on value exact match of value presence of header
Header Match can also be inverse of above, which be used to check missing header or non-matching value.
object
object
Exclusive with [DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must contain.
Exclusive with [Contains DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not contain.
Exclusive with [Contains DoesNotContain DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not equal.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual Endswith Equals MatchRegex Startswith] Field must not start with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Equals MatchRegex Startswith] Field must end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith MatchRegex Startswith] Field must exactly match.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals Startswith] Field matches PCRE 1 compliant regular expression.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex] Field must start with.
A list of predicates for all cookies that need to be matched. The criteria for matching each cookie is described in individual instances of CookieMatcherType. The actual cookie values are extracted from the request API as a list of strings for each cookie name. Note that all specified cookie matcher predicates must evaluate to true.
A cookie matcher specifies the name of a single cookie and the criteria to match it. The input has a list of values for each cookie in the request. A cookie matcher can check for one of the following:
- Presence or absence of the cookie
- At least one of the values for the cookie in the request satisfies the MatcherType item.
object
A case-sensitive cookie name. Required: YES.
object
Exclusive with [DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must contain.
Exclusive with [Contains DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not contain.
Exclusive with [Contains DoesNotContain DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not equal.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual Endswith Equals MatchRegex Startswith] Field must not start with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Equals MatchRegex Startswith] Field must end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith MatchRegex Startswith] Field must exactly match.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals Startswith] Field matches PCRE 1 compliant regular expression.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex] Field must start with.
object
object
Exclusive with [DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must contain.
Exclusive with [Contains DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not contain.
Exclusive with [Contains DoesNotContain DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not equal.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual Endswith Equals MatchRegex Startswith] Field must not start with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Equals MatchRegex Startswith] Field must end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith MatchRegex Startswith] Field must exactly match.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals Startswith] Field matches PCRE 1 compliant regular expression.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex] Field must start with.
List of (key, value) query parameters.
Query parameter match can be either regex match on value or exact match of value for given key An example for HTTP request with query parameter https://gitlab.com/dashboard/issues?assignee_username=xxyyxx.
object
Query parameter key In the above example, assignee_username is the key Required: YES.
object
Exclusive with [DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must contain.
Exclusive with [Contains DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not contain.
Exclusive with [Contains DoesNotContain DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotStartWith Endswith Equals MatchRegex Startswith] Field must not equal.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual Endswith Equals MatchRegex Startswith] Field must not start with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Equals MatchRegex Startswith] Field must end with.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith MatchRegex Startswith] Field must exactly match.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals Startswith] Field matches PCRE 1 compliant regular expression.
Exclusive with [Contains DoesNotContain DoesNotEndWith DoesNotEqual DoesNotStartWith Endswith Equals MatchRegex] Field must start with.
Name of the Expressions items that are ANDed Required: YES.
Name of the Cache Rule Required: YES.
object
CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.
A value identifying the class of the user or service which created this configuration object.
A value identifying the exact user or service that created this configuration object.
DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.
Populated by the system when a graceful deletion is requested. Read-only.
Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.
object
Pending is a list of initializers that must execute in order before this object is initialized. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.
Initializer is information about an initializer that has not yet completed.
object
Name of the service that is responsible for initializing this object.
object
Suggested HTTP return code for this status, 0 if not set.
A human-readable description of why this operation is in the “Failure” status. If this value is empty there is no information available.
Status of the operation. One of: “Success” or “Failure”.
Map of string keys and values that can be used to organize and categorize (scope and select) objects as chosen by the operator or software. Values here can be interpreted by software(backend or frontend) to enable certain behavior e.g. Things marked as soft-deleted(restorable).
object
ModificationTimestamp is a timestamp representing the server time when this object was last modified.
Unique index for the object. Some objects need a unique integer index to be allocated for each object type. This field will be populated for all objects that need it and will be zero otherwise.
object
Kind of the view object.
When a configuration object(e.g. Virtual_host) refers to another(e.g route) then name will hold the referred object’s(e.g. Route’s) name.
When a configuration object(e.g. Virtual_host) refers to another(e.g route) then namespace will hold the referred object’s(e.g. Route’s) namespace.
UID of the view object.
Tenant to which this configuration object belongs to. The value for this is found from presented credentials.
Uid is the unique in time and space value for this object. It is generated by the server on successful creation of an object and is not allowed to change on Replace API. The value of is taken from uid field of ObjectMetaType, if provided.
Example
{ "spec": { "cache_rules": { "rule_expression_list": [ { "cache_rule_expression": [ { "cache_headers": [ { "name": "PROXY_HOST" } ] } ] } ] } }}Returned when operation is not authorized.
Examplegenerated
exampleReturned when there is no permission to access resource.
Examplegenerated
exampleReturned when resource is not found.
Examplegenerated
exampleReturned when operation on resource is conflicting with current value.
Examplegenerated
exampleReturned when operation has been rejected as it is happening too frequently.
Examplegenerated
exampleReturned when server encountered an error in processing API.
Examplegenerated
exampleReturned when service is unavailable temporarily.
Examplegenerated
exampleReturned when server timed out processing request.
Examplegenerated
example