Cloud CDN API, gRPC: ResourceService.Create
- gRPC request
- CreateResourceRequest
- Origin
- ResourceOriginParams
- OriginMeta
- OriginNamedMeta
- OriginBalancerMeta
- SecondaryHostnames
- ResourceOptions
- BoolOption
- EdgeCacheSettings
- CachingTimes
- Int64Option
- StringsListOption
- QueryParamsOptions
- CompressionOptions
- RedirectOptions
- HostOptions
- StringOption
- StringsMapOption
- RewriteOption
- SecureKeyOption
- IPAddressACLOption
- FollowRedirectsOption
- WebsocketsOption
- HeaderFilterOption
- GeoACLOption
- ReferrerACLOption
- StaticResponseOption
- SSLTargetCertificate
- SSLCertificateData
- SSLCertificateCMData
- TLS
- operation.Operation
Creates a CDN resource in the specified folder.
Creation may take up to 15 minutes.
gRPC request
rpc Create (CreateResourceRequest) returns (operation.Operation)
CreateResourceRequest
{
"folder_id": "string",
"cname": "string",
"origin": {
// Includes only one of the fields `origin_group_id`, `origin_source`, `origin_source_params`
"origin_group_id": "int64",
"origin_source": "string",
"origin_source_params": {
"source": "string",
"meta": {
// Includes only one of the fields `common`, `bucket`, `website`, `balancer`
"common": {
"name": "string"
},
"bucket": {
"name": "string"
},
"website": {
"name": "string"
},
"balancer": {
"id": "string"
}
// end of the list of possible fields
}
}
// end of the list of possible fields
},
"secondary_hostnames": {
"values": [
"string"
]
},
"origin_protocol": "OriginProtocol",
"active": "google.protobuf.BoolValue",
"options": {
"disable_cache": {
"enabled": "bool",
"value": "bool"
},
"edge_cache_settings": {
// Includes only one of the fields `value`, `default_value`
"value": {
"simple_value": "int64",
"custom_values": "map<string, int64>"
},
"default_value": "int64",
// end of the list of possible fields
"enabled": "bool"
},
"browser_cache_settings": {
"enabled": "bool",
"value": "int64"
},
"cache_http_headers": {
"enabled": "bool",
"value": [
"string"
]
},
"query_params_options": {
// Includes only one of the fields `ignore_query_string`, `query_params_whitelist`, `query_params_blacklist`
"ignore_query_string": {
"enabled": "bool",
"value": "bool"
},
"query_params_whitelist": {
"enabled": "bool",
"value": [
"string"
]
},
"query_params_blacklist": {
"enabled": "bool",
"value": [
"string"
]
}
// end of the list of possible fields
},
"slice": {
"enabled": "bool",
"value": "bool"
},
"compression_options": {
// Includes only one of the fields `fetch_compressed`, `gzip_on`, `brotli_compression`
"fetch_compressed": {
"enabled": "bool",
"value": "bool"
},
"gzip_on": {
"enabled": "bool",
"value": "bool"
},
"brotli_compression": {
"enabled": "bool",
"value": [
"string"
]
}
// end of the list of possible fields
},
"redirect_options": {
// Includes only one of the fields `redirect_http_to_https`, `redirect_https_to_http`
"redirect_http_to_https": {
"enabled": "bool",
"value": "bool"
},
"redirect_https_to_http": {
"enabled": "bool",
"value": "bool"
}
// end of the list of possible fields
},
"host_options": {
// Includes only one of the fields `host`, `forward_host_header`
"host": {
"enabled": "bool",
"value": "string"
},
"forward_host_header": {
"enabled": "bool",
"value": "bool"
}
// end of the list of possible fields
},
"static_headers": {
"enabled": "bool",
"value": "map<string, string>"
},
"cors": {
"enabled": "bool",
"value": [
"string"
]
},
"stale": {
"enabled": "bool",
"value": [
"string"
]
},
"allowed_http_methods": {
"enabled": "bool",
"value": [
"string"
]
},
"proxy_cache_methods_set": {
"enabled": "bool",
"value": "bool"
},
"disable_proxy_force_ranges": {
"enabled": "bool",
"value": "bool"
},
"static_request_headers": {
"enabled": "bool",
"value": "map<string, string>"
},
"custom_server_name": {
"enabled": "bool",
"value": "string"
},
"ignore_cookie": {
"enabled": "bool",
"value": "bool"
},
"rewrite": {
"enabled": "bool",
"body": "string",
"flag": "RewriteFlag"
},
"secure_key": {
"enabled": "bool",
"key": "string",
"type": "SecureKeyURLType"
},
"ip_address_acl": {
"enabled": "bool",
"policy_type": "PolicyType",
"excepted_values": [
"string"
]
},
"follow_redirects": {
"enabled": "bool",
"codes": [
"int64"
],
"use_custom_host": "bool"
},
"websockets": {
"enabled": "bool"
},
"header_filter": {
"enabled": "bool",
"headers": [
"string"
]
},
"geo_acl": {
"enabled": "bool",
"mode": "Mode",
"countries": [
"string"
]
},
"referrer_acl": {
"enabled": "bool",
"mode": "Mode",
"referrers": [
"string"
]
},
"static_response": {
"enabled": "bool",
"code": "int64",
"content": "string"
}
},
"ssl_certificate": {
"type": "SSLCertificateType",
"data": {
// Includes only one of the fields `cm`
"cm": {
"id": "string"
}
// end of the list of possible fields
}
},
"labels": "map<string, string>",
"provider_type": "string",
"tls": {
"profile": "Profile"
}
}
|
Field |
Description |
|
folder_id |
string Required field. ID of the to bind with new resource. The maximum string length in characters is 50. |
|
cname |
string Required field. CDN endpoint CNAME, must be unique among clients's resources. |
|
origin |
Required field. Specify the origins to be used for CDN resources requests. |
|
secondary_hostnames |
List of additional CNAMEs. |
|
origin_protocol |
enum OriginProtocol Specify the protocol schema to be used in communication with origin.
|
|
active |
Flag to create Resource either in active or disabled state. |
|
options |
Resource settings and options to tune CDN edge behavior. Most is unset. |
|
ssl_certificate |
SSL Certificate options. |
|
labels |
object (map<string, string>) Labels of the resource. |
|
provider_type |
string Set up resource provider |
|
tls |
TLS configuration for the resource. |
Origin
|
Field |
Description |
|
origin_group_id |
int64 ID of pre-created origin group. Includes only one of the fields |
|
origin_source |
string Create new Origins group with single source, it's id will be Includes only one of the fields |
|
origin_source_params |
Set up resource origin parameters. Includes only one of the fields |
ResourceOriginParams
A set of resource origin parameters.
|
Field |
Description |
|
source |
string Source of the content. |
|
meta |
Set up type of the origin. |
OriginMeta
Origin type. For details about the concept, see documentation.
|
Field |
Description |
|
common |
A server with a domain name linked to it Includes only one of the fields Type of the origin. |
|
bucket |
An Object Storage bucket not configured as a static site hosting. Includes only one of the fields Type of the origin. |
|
website |
An Object Storage bucket configured as a static site hosting. Includes only one of the fields Type of the origin. |
|
balancer |
An L7 load balancer from Application Load Balancer. Includes only one of the fields Type of the origin. |
OriginNamedMeta
Origin info. For details about the concept, see documentation.
|
Field |
Description |
|
name |
string Name of the origin. |
OriginBalancerMeta
Application Load Balancer origin info. For details about the concept, see documentation.
|
Field |
Description |
|
id |
string ID of the origin. |
SecondaryHostnames
List of secondary (alternative) CNAMEs.
|
Field |
Description |
|
values[] |
string List of secondary hostname values. |
ResourceOptions
A major set of various resource options.
|
Field |
Description |
|
disable_cache |
Set up a cache status. |
|
edge_cache_settings |
Set up EdgeCacheSettings. |
|
browser_cache_settings |
Using Int64Option. Set up a cache period for the end-users browser. |
|
cache_http_headers |
List HTTP headers that must be included in responses to clients. |
|
query_params_options |
Set up QueryParamsOptions. |
|
slice |
Files larger than 10 MB will be requested and cached in parts (no larger than 10 MB each part). It reduces time to first byte. |
|
compression_options |
Set up compression variant. |
|
redirect_options |
Set up redirects. |
|
host_options |
Set up host parameters. |
|
static_headers |
Set up static headers that CDN servers send in responses to clients. |
|
cors |
Parameter that lets browsers get access to selected resources from a domain |
|
stale |
List of errors which instruct CDN servers to serve stale content to clients. |
|
allowed_http_methods |
HTTP methods for your CDN content. By default the following methods |
|
proxy_cache_methods_set |
Allows caching for GET, HEAD and POST requests. |
|
disable_proxy_force_ranges |
Disabling proxy force ranges. |
|
static_request_headers |
Set up custom headers that CDN servers send in requests to origins. |
|
custom_server_name |
Wildcard additional CNAME. |
|
ignore_cookie |
Using BoolOption for ignoring cookie. |
|
rewrite |
Changing or redirecting query paths. |
|
secure_key |
Secure token to protect contect and limit access by IP addresses and time limits. |
|
ip_address_acl |
Manage the state of the IP access policy option. |
|
follow_redirects |
Manage the state of the Redirection from origin option. |
|
websockets |
Configuration for WebSocket protocol support. |
|
header_filter |
Configuration for HTTP response header filtering. |
|
geo_acl |
Configuration for geographic access control. |
|
referrer_acl |
Configuration for referrer-based access control. |
|
static_response |
Configuration for serving a static HTTP response instead of fetching from origin. |
BoolOption
Set up bool values.
|
Field |
Description |
|
enabled |
bool True - the option is enabled and its |
|
value |
bool Value of the option. |
EdgeCacheSettings
A set of the edge cache parameters.
|
Field |
Description |
|
value |
Value of the option. Includes only one of the fields |
|
default_value |
int64 Content will be cached according to origin cache settings. Includes only one of the fields |
|
enabled |
bool True - the option is enabled and its |
CachingTimes
A set of the caching response time parameters.
|
Field |
Description |
|
simple_value |
int64 Caching time for a response with codes 200, 206, 301, 302. |
|
custom_values |
object (map<string, int64>) Caching time for a response with specific codes. These settings have a higher priority than the value field. |
Int64Option
A set of the numeric parameters.
|
Field |
Description |
|
enabled |
bool True - the option is enabled and its |
|
value |
int64 Value of the option. |
StringsListOption
A set of the string list parameters.
|
Field |
Description |
|
enabled |
bool True - the option is enabled and its |
|
value[] |
string Value of the option. |
QueryParamsOptions
A set of the query parameters.
|
Field |
Description |
|
ignore_query_string |
Using BoolOption. Selected by default. Files with different query parameters are cached as objects with the same key regardless of the parameter value. Includes only one of the fields |
|
query_params_whitelist |
Ignore All Except. Includes only one of the fields |
|
query_params_blacklist |
Ignore only. Files with the specified query parameters are cached as objects with the same key, Includes only one of the fields |
CompressionOptions
A set of the compression variant parameters.
|
Field |
Description |
|
fetch_compressed |
The Fetch compressed option helps you to reduce Includes only one of the fields |
|
gzip_on |
Using BoolOption. GZip compression at CDN servers reduces file size by 70% and can be as high as 90%. Includes only one of the fields |
|
brotli_compression |
The option allows to compress content with brotli on the CDN's end. Includes only one of the fields |
RedirectOptions
A set of the redirect parameters.
|
Field |
Description |
|
redirect_http_to_https |
Using BoolOption. Set up a redirect from HTTPS to HTTP. Includes only one of the fields |
|
redirect_https_to_http |
Using BoolOption. Set up a redirect from HTTP to HTTPS. Includes only one of the fields |
HostOptions
A set of the host parameters.
|
Field |
Description |
|
host |
Custom value for the Host header. Includes only one of the fields |
|
forward_host_header |
Using BoolOption. Choose the Forward Host header option if is important to send in the request to the Origin Includes only one of the fields |
StringOption
A set of the string parameters.
|
Field |
Description |
|
enabled |
bool True - the option is enabled and its |
|
value |
string Value of the option. |
StringsMapOption
A set of the strings map parameters.
|
Field |
Description |
|
enabled |
bool True - the option is enabled and its |
|
value |
object (map<string, string>) Value of the option. |
RewriteOption
An option for changing or redirecting query paths.
|
Field |
Description |
|
enabled |
bool True - the option is enabled and its |
|
body |
string Pattern for rewrite. |
|
flag |
enum RewriteFlag Break flag is applied to the option by default.
|
SecureKeyOption
|
Field |
Description |
|
enabled |
bool True - the option is enabled and its flag is applied to the resource. |
|
key |
string The key for the URL signing. |
|
type |
enum SecureKeyURLType The type of the URL signing. The URL could be available for all IP addresses or for the only one IP.
|
IPAddressACLOption
|
Field |
Description |
|
enabled |
bool True - the option is enabled and its flag is applied to the resource. |
|
policy_type |
enum PolicyType The policy type. One of allow or deny value.
|
|
excepted_values[] |
string The list of IP addresses to be allowed or denied. |
FollowRedirectsOption
|
Field |
Description |
|
enabled |
bool True - the option is enabled and its flag is applied to the resource. |
|
codes[] |
int64 Add the redirect HTTP status codes that the source returns. |
|
use_custom_host |
bool Use the redirect target domain as a Host header, or leave it the same as the value of the Change Host header option. |
WebsocketsOption
|
Field |
Description |
|
enabled |
bool Enables or disables feature. |
HeaderFilterOption
|
Field |
Description |
|
enabled |
bool Enables or disables feature. |
|
headers[] |
string Whitelist of headers. |
GeoACLOption
|
Field |
Description |
|
enabled |
bool Enables or disables the Geo ACL option. |
|
mode |
enum Mode Mode of the Geo ACL.
|
|
countries[] |
string List of country codes (ISO 3166, uppercase). |
ReferrerACLOption
|
Field |
Description |
|
enabled |
bool Enables or disables feature. |
|
mode |
enum Mode Access mode for the referrer list.
|
|
referrers[] |
string List of referer patterns. Supports three types of values:
|
StaticResponseOption
|
Field |
Description |
|
enabled |
bool Enables or disables feature. |
|
code |
int64 HTTP status code. |
|
content |
string A string containing the response content. |
SSLTargetCertificate
A set of the personal SSL certificate parameters.
|
Field |
Description |
|
type |
enum SSLCertificateType Type of the certificate.
|
|
data |
Certificate data. |
SSLCertificateData
A certificate data parameters.
|
Field |
Description |
|
cm |
Custom (add your SSL certificate by uploading the certificate Includes only one of the fields |
SSLCertificateCMData
A certificate data custom parameters.
|
Field |
Description |
|
id |
string ID of the custom certificate. |
TLS
|
Field |
Description |
|
profile |
enum Profile TLS profile used for the resource.
|
operation.Operation
{
"id": "string",
"description": "string",
"created_at": "google.protobuf.Timestamp",
"created_by": "string",
"modified_at": "google.protobuf.Timestamp",
"done": "bool",
"metadata": "google.protobuf.Any",
// Includes only one of the fields `error`, `response`
"error": "google.rpc.Status",
"response": "google.protobuf.Any"
// end of the list of possible fields
}
An Operation resource. For more information, see Operation.
|
Field |
Description |
|
id |
string ID of the operation. |
|
description |
string Description of the operation. 0-256 characters long. |
|
created_at |
Creation timestamp. |
|
created_by |
string ID of the user or service account who initiated the operation. |
|
modified_at |
The time when the Operation resource was last modified. |
|
done |
bool If the value is |
|
metadata |
Service-specific metadata associated with the operation. |
|
error |
The error result of the operation in case of failure or cancellation. Includes only one of the fields The operation result. |
|
response |
The normal response of the operation in case of success. Includes only one of the fields The operation result. |