diff --git a/api.go b/api.go index c5b8c2e..2ac7a10 100644 --- a/api.go +++ b/api.go @@ -2901,14 +2901,24 @@ func (sc *Client) DeleteEdgeDeployment(corpName, siteName string) error { return err } +type CreateOrUpdateEdgeDeploymentServiceBody struct { + ActivateVersion *bool `json:"activateVersion,omitempty"` //Activate Fastly VCL service after clone + PercentEnabled int `json:"percentEnabled,omitempty"` //Percentage of traffic to send to NGWAF@Edge +} + // CreateOrUpdateEdgeDeploymentService copies the backends from the Fastly service to the // Edge Deployment and pre-configures the Fastly service with an edge dictionary and custom VCL. -func (sc *Client) CreateOrUpdateEdgeDeploymentService(corpName, siteName, fastlySID string) error { +func (sc *Client) CreateOrUpdateEdgeDeploymentService(corpName, siteName, fastlySID string, body CreateOrUpdateEdgeDeploymentServiceBody) error { if sc.fastlyKey == "" { return errors.New("please set Fastly-Key with the client.SetFastlyKey method") } - _, err := sc.doRequest("PUT", fmt.Sprintf("/v0/corps/%s/sites/%s/edgeDeployment/%s", corpName, siteName, fastlySID), "") + b, err := json.Marshal(body) + if err != nil { + return err + } + + _, err = sc.doRequest("PUT", fmt.Sprintf("/v0/corps/%s/sites/%s/edgeDeployment/%s", corpName, siteName, fastlySID), string(b)) return err }