From 4ec3d1b924e1e38f38323d9e839e5d82575269c5 Mon Sep 17 00:00:00 2001 From: Netlify Bot Date: Mon, 18 May 2026 14:35:47 +0100 Subject: [PATCH 1/2] feat: add per-function `region` parameter --- go/porcelain/deploy.go | 3 ++- go/porcelain/functions_manifest.go | 1 + swagger.yml | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/go/porcelain/deploy.go b/go/porcelain/deploy.go index 67fc98f0..bdef002e 100644 --- a/go/porcelain/deploy.go +++ b/go/porcelain/deploy.go @@ -840,11 +840,12 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep } } - hasConfig := function.DisplayName != "" || function.Generator != "" || len(routes) > 0 || len(excludedRoutes) > 0 || len(function.BuildData) > 0 || function.Priority != 0 || function.TrafficRules != nil || function.Timeout != 0 || len(function.EventSubscriptions) > 0 + hasConfig := function.DisplayName != "" || function.Generator != "" || len(routes) > 0 || len(excludedRoutes) > 0 || len(function.BuildData) > 0 || function.Priority != 0 || function.TrafficRules != nil || function.Timeout != 0 || len(function.EventSubscriptions) > 0 || function.Region != "" if hasConfig { cfg := models.FunctionConfig{ DisplayName: function.DisplayName, Generator: function.Generator, + Region: function.Region, Routes: routes, ExcludedRoutes: excludedRoutes, BuildData: function.BuildData, diff --git a/go/porcelain/functions_manifest.go b/go/porcelain/functions_manifest.go index cb160b03..4d4e44a9 100644 --- a/go/porcelain/functions_manifest.go +++ b/go/porcelain/functions_manifest.go @@ -12,6 +12,7 @@ type functionsManifestEntry struct { MainFile string `json:"mainFile"` Name string `json:"name"` Path string `json:"path"` + Region string `json:"region"` Runtime string `json:"runtime"` RuntimeVersion string `json:"runtimeVersion"` Schedule string `json:"schedule"` diff --git a/swagger.yml b/swagger.yml index fdb0ec53..1d04cce5 100644 --- a/swagger.yml +++ b/swagger.yml @@ -4586,6 +4586,8 @@ definitions: type: string sha: type: string + region: + type: string snippet: type: object properties: @@ -4689,6 +4691,22 @@ definitions: type: array items: $ref: '#/definitions/functionSchedule' + functions_region: + type: string + description: | + The functions region for this deploy as an airport code. + functions_region_overrides: + type: array + items: + type: object + properties: + name: + type: string + region: + type: string + description: | + Functions in the deploy that explicitly specify their own region + (airport code). deployEnvironmentVariable: type: object required: @@ -5547,6 +5565,8 @@ definitions: $ref: '#/definitions/excludedFunctionRoute' priority: type: integer + region: + type: string traffic_rules: $ref: '#/definitions/trafficRulesConfig' event_subscriptions: From 8934397ff29419e27a09c39bee958b8af115ad0d Mon Sep 17 00:00:00 2001 From: Netlify Bot Date: Mon, 18 May 2026 14:38:40 +0100 Subject: [PATCH 2/2] add generated code --- go/models/deploy.go | 38 +++++++++++++++ ...deploy_functions_region_overrides_items.go | 46 +++++++++++++++++++ go/models/function.go | 3 ++ go/models/function_config.go | 3 ++ 4 files changed, 90 insertions(+) create mode 100644 go/models/deploy_functions_region_overrides_items.go diff --git a/go/models/deploy.go b/go/models/deploy.go index 5f1ba273..b9ad2336 100644 --- a/go/models/deploy.go +++ b/go/models/deploy.go @@ -57,6 +57,15 @@ type Deploy struct { // function schedules FunctionSchedules []*FunctionSchedule `json:"function_schedules"` + // The functions region for this deploy as an airport code. + // + FunctionsRegion string `json:"functions_region,omitempty"` + + // Functions in the deploy that explicitly specify their own region + // (airport code). + // + FunctionsRegionOverrides []*DeployFunctionsRegionOverridesItems `json:"functions_region_overrides"` + // id ID string `json:"id,omitempty"` @@ -120,6 +129,10 @@ func (m *Deploy) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateFunctionsRegionOverrides(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -151,6 +164,31 @@ func (m *Deploy) validateFunctionSchedules(formats strfmt.Registry) error { return nil } +func (m *Deploy) validateFunctionsRegionOverrides(formats strfmt.Registry) error { + + if swag.IsZero(m.FunctionsRegionOverrides) { // not required + return nil + } + + for i := 0; i < len(m.FunctionsRegionOverrides); i++ { + if swag.IsZero(m.FunctionsRegionOverrides[i]) { // not required + continue + } + + if m.FunctionsRegionOverrides[i] != nil { + if err := m.FunctionsRegionOverrides[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("functions_region_overrides" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Deploy) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/go/models/deploy_functions_region_overrides_items.go b/go/models/deploy_functions_region_overrides_items.go new file mode 100644 index 00000000..432a521e --- /dev/null +++ b/go/models/deploy_functions_region_overrides_items.go @@ -0,0 +1,46 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// DeployFunctionsRegionOverridesItems deploy functions region overrides items +// +// swagger:model deployFunctionsRegionOverridesItems +type DeployFunctionsRegionOverridesItems struct { + + // name + Name string `json:"name,omitempty"` + + // region + Region string `json:"region,omitempty"` +} + +// Validate validates this deploy functions region overrides items +func (m *DeployFunctionsRegionOverridesItems) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DeployFunctionsRegionOverridesItems) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DeployFunctionsRegionOverridesItems) UnmarshalBinary(b []byte) error { + var res DeployFunctionsRegionOverridesItems + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/go/models/function.go b/go/models/function.go index ca550515..a0fc00bd 100644 --- a/go/models/function.go +++ b/go/models/function.go @@ -21,6 +21,9 @@ type Function struct { // name Name string `json:"name,omitempty"` + // region + Region string `json:"region,omitempty"` + // sha Sha string `json:"sha,omitempty"` } diff --git a/go/models/function_config.go b/go/models/function_config.go index 56ce6578..dbe30e12 100644 --- a/go/models/function_config.go +++ b/go/models/function_config.go @@ -36,6 +36,9 @@ type FunctionConfig struct { // priority Priority int64 `json:"priority,omitempty"` + // region + Region string `json:"region,omitempty"` + // routes Routes []*FunctionRoute `json:"routes"`