Skip to content

Commit

Permalink
Add new Enhanced Origin API fields. (GoogleCloudPlatform#6846)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlyeks authored and Ray Xu committed Dec 5, 2022
1 parent 82afbe8 commit 49e0373
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 2 deletions.
71 changes: 71 additions & 0 deletions mmv1/products/networkservices/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,77 @@ objects:
required: true
description: |
The name of the AWS region that your origin is in.
- !ruby/object:Api::Type::NestedObject
name: 'originOverrideAction'
description: |
The override actions, including url rewrites and header
additions, for requests that use this origin.
properties:
- !ruby/object:Api::Type::NestedObject
name: 'urlRewrite'
description: |
The URL rewrite configuration for request that are
handled by this origin.
properties:
- !ruby/object:Api::Type::String
name: 'hostRewrite'
description: |
Prior to forwarding the request to the selected
origin, the request's host header is replaced with
contents of the hostRewrite.
This value must be between 1 and 255 characters.
- !ruby/object:Api::Type::NestedObject
name: 'headerAction'
description: |
The header actions, including adding and removing
headers, for request handled by this origin.
properties:
- !ruby/object:Api::Type::Array
name: requestHeadersToAdd
description: |
Describes a header to add.
You may add a maximum of 5 request headers.
min_size: 1
max_size: 5
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::String
name: 'headerName'
required: true
description: |
The name of the header to add.
- !ruby/object:Api::Type::String
name: 'headerValue'
required: true
description: |
The value of the header to add.
- !ruby/object:Api::Type::Boolean
name: 'replace'
description: |
Whether to replace all existing headers with the same name.
By default, added header values are appended
to the response or request headers with the
same field names. The added values are
separated by commas.
To overwrite existing values, set `replace` to `true`.
- !ruby/object:Api::Type::NestedObject
name: 'originRedirect'
description: |
Follow redirects from this origin.
properties:
- !ruby/object:Api::Type::Array
name: 'redirectConditions'
description: |
The set of redirect response codes that the CDN
follows. Values of
[RedirectConditions](https://cloud.google.com/media-cdn/docs/reference/rest/v1/projects.locations.edgeCacheOrigins#redirectconditions)
are accepted.
max_size: 5
item_type: Api::Type::String
- !ruby/object:Api::Resource
name: 'EdgeCacheService'
base_url: 'projects/{{project}}/locations/global/edgeCacheServices'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

resource "google_network_services_edge_cache_origin" "fallback" {
name = "<%= ctx[:vars]['resource_name_2'] %>"
origin_address = "gs://media-edge-fallback"
origin_address = "fallback.example.com"
description = "The default bucket for media edge test"
max_attempts = 3
protocol = "HTTP"
Expand All @@ -19,6 +18,27 @@ resource "google_network_services_edge_cache_origin" "fallback" {
response_timeout = "60s"
read_timeout = "5s"
}
origin_override_action {
url_rewrite {
host_rewrite = "example.com"
}
header_action {
request_headers_to_add {
header_name = "x-header"
header_value = "value"
replace = true
}
}
}
origin_redirect {
redirect_conditions = [
"MOVED_PERMANENTLY",
"FOUND",
"SEE_OTHER",
"TEMPORARY_REDIRECT",
"PERMANENT_REDIRECT",
]
}
}

resource "google_network_services_edge_cache_origin" "<%= ctx[:primary_resource_id] %>" {
Expand Down

0 comments on commit 49e0373

Please sign in to comment.