From 39fd97571452f833ba4e59af80820e54ac209b75 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 06:14:06 +0100 Subject: [PATCH] build(deps): bump github.com/fastly/go-fastly/v9 from 9.9.0 to 9.10.0 (#883) Bumps [github.com/fastly/go-fastly/v9](https://github.com/fastly/go-fastly) from 9.9.0 to 9.10.0. - [Release notes](https://github.com/fastly/go-fastly/releases) - [Changelog](https://github.com/fastly/go-fastly/blob/main/CHANGELOG.md) - [Commits](https://github.com/fastly/go-fastly/compare/v9.9.0...v9.10.0) --- updated-dependencies: - dependency-name: github.com/fastly/go-fastly/v9 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 +- .../go-fastly/v9/fastly/account_events.go | 3 +- .../fastly/go-fastly/v9/fastly/acl.go | 17 +++-- .../fastly/go-fastly/v9/fastly/acl_entry.go | 15 ++-- .../fastly/go-fastly/v9/fastly/alerts.go | 10 +-- .../fastly/go-fastly/v9/fastly/backend.go | 17 +++-- .../fastly/go-fastly/v9/fastly/billing.go | 4 +- .../go-fastly/v9/fastly/compute_package.go | 4 +- .../go-fastly/v9/fastly/config_store.go | 16 +++-- .../go-fastly/v9/fastly/config_store_item.go | 19 +++--- .../fastly/go-fastly/v9/fastly/dictionary.go | 18 +++-- .../go-fastly/v9/fastly/dictionary_info.go | 5 +- .../go-fastly/v9/fastly/dictionary_item.go | 22 +++--- .../fastly/go-fastly/v9/fastly/diff.go | 5 +- .../fastly/go-fastly/v9/fastly/domain.go | 23 ++++--- .../go-fastly/v9/fastly/health_check.go | 18 +++-- .../fastly/go-fastly/v9/fastly/helpers.go | 25 +++++++ .../image_optimizer_default_settings.go | 6 +- .../fastly/go-fastly/v9/fastly/kv_store.go | 21 ++++-- .../go-fastly/v9/fastly/load_balance_pool.go | 17 +++-- .../v9/fastly/load_balancer_director.go | 13 ++-- .../fastly/load_balancer_director_backend.go | 12 ++-- .../v9/fastly/load_balancer_server.go | 16 +++-- .../go-fastly/v9/fastly/logging_bigquery.go | 12 ++-- .../v9/fastly/logging_blobstorage.go | 13 ++-- .../go-fastly/v9/fastly/logging_cloudfiles.go | 13 ++-- .../go-fastly/v9/fastly/logging_datadog.go | 13 ++-- .../v9/fastly/logging_digitalocean.go | 13 ++-- .../v9/fastly/logging_elasticsearch.go | 13 ++-- .../fastly/go-fastly/v9/fastly/logging_ftp.go | 13 ++-- .../fastly/go-fastly/v9/fastly/logging_gcs.go | 13 ++-- .../go-fastly/v9/fastly/logging_heroku.go | 13 ++-- .../go-fastly/v9/fastly/logging_honeycomb.go | 13 ++-- .../go-fastly/v9/fastly/logging_https.go | 13 ++-- .../go-fastly/v9/fastly/logging_kafka.go | 13 ++-- .../go-fastly/v9/fastly/logging_kinesis.go | 13 ++-- .../go-fastly/v9/fastly/logging_logentries.go | 13 ++-- .../go-fastly/v9/fastly/logging_loggly.go | 13 ++-- .../go-fastly/v9/fastly/logging_logshuttle.go | 13 ++-- .../go-fastly/v9/fastly/logging_newrelic.go | 13 ++-- .../v9/fastly/logging_newrelicotlp.go | 13 ++-- .../go-fastly/v9/fastly/logging_openstack.go | 13 ++-- .../go-fastly/v9/fastly/logging_papertrail.go | 13 ++-- .../go-fastly/v9/fastly/logging_pubsub.go | 13 ++-- .../fastly/go-fastly/v9/fastly/logging_s3.go | 13 ++-- .../go-fastly/v9/fastly/logging_scalyr.go | 13 ++-- .../go-fastly/v9/fastly/logging_sftp.go | 13 ++-- .../go-fastly/v9/fastly/logging_splunk.go | 13 ++-- .../go-fastly/v9/fastly/logging_sumologic.go | 13 ++-- .../go-fastly/v9/fastly/logging_syslog.go | 13 ++-- .../go-fastly/v9/fastly/managed_logging.go | 5 +- .../go-fastly/v9/fastly/notifications.go | 16 +++-- .../go-fastly/v9/fastly/product_enablement.go | 13 ++-- .../fastly/go-fastly/v9/fastly/purge.go | 8 +-- .../fastly/go-fastly/v9/fastly/resource.go | 12 ++-- .../go-fastly/v9/fastly/secret_store.go | 40 +++++------ .../v9/fastly/service_authorization.go | 9 ++- .../go-fastly/v9/fastly/service_details.go | 59 +++++++++------- .../go-fastly/v9/fastly/service_version.go | 68 +++++++++++++------ .../v9/fastly/stats_domain_inspector.go | 4 +- .../go-fastly/v9/fastly/stats_historical.go | 14 ++-- .../v9/fastly/stats_origin_inspector.go | 4 +- .../go-fastly/v9/fastly/stats_realtime.go | 8 ++- .../v9/fastly/tls_custom_activation.go | 18 ++--- .../v9/fastly/tls_custom_certificate.go | 18 ++--- .../v9/fastly/tls_custom_configuration.go | 11 +-- .../v9/fastly/tls_mutual_authentication.go | 18 ++--- .../go-fastly/v9/fastly/tls_platform.go | 18 ++--- .../go-fastly/v9/fastly/tls_private_keys.go | 15 ++-- .../go-fastly/v9/fastly/tls_subscription.go | 8 ++- .../fastly/go-fastly/v9/fastly/token.go | 7 +- .../fastly/go-fastly/v9/fastly/user.go | 17 +++-- .../go-fastly/v9/fastly/vcl_cache_setting.go | 13 ++-- .../go-fastly/v9/fastly/vcl_condition.go | 13 ++-- .../fastly/go-fastly/v9/fastly/vcl_custom.go | 17 +++-- .../fastly/go-fastly/v9/fastly/vcl_gzip.go | 13 ++-- .../fastly/go-fastly/v9/fastly/vcl_header.go | 13 ++-- .../fastly/go-fastly/v9/fastly/vcl_http3.go | 8 +-- .../go-fastly/v9/fastly/vcl_rate_limiter.go | 14 ++-- .../v9/fastly/vcl_request_setting.go | 13 ++-- .../v9/fastly/vcl_response_object.go | 13 ++-- .../go-fastly/v9/fastly/vcl_settings.go | 8 +-- .../go-fastly/v9/fastly/vcl_snippets.go | 19 +++--- .../fastly/go-fastly/v9/fastly/waf.go | 9 ++- .../go-fastly/v9/fastly/waf_active_rule.go | 9 ++- .../go-fastly/v9/fastly/waf_rule_exclusion.go | 12 ++-- .../fastly/go-fastly/v9/fastly/waf_version.go | 21 ++++-- vendor/modules.txt | 2 +- 89 files changed, 687 insertions(+), 562 deletions(-) diff --git a/go.mod b/go.mod index 360165c82..d547f7500 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/bflad/tfproviderlint v0.30.0 - github.com/fastly/go-fastly/v9 v9.9.0 + github.com/fastly/go-fastly/v9 v9.10.0 github.com/google/go-cmp v0.6.0 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/terraform-plugin-docs v0.19.4 diff --git a/go.sum b/go.sum index 119b7298e..fa5a81473 100644 --- a/go.sum +++ b/go.sum @@ -36,8 +36,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= -github.com/fastly/go-fastly/v9 v9.9.0 h1:VDCyORoWi608l/LBp+tY+qic3M5/5ZFw+rtAfV6VR9E= -github.com/fastly/go-fastly/v9 v9.9.0/go.mod h1:5w2jgJBZqQEebOwM/rRg7wutAcpDTziiMYWb/6qdM7U= +github.com/fastly/go-fastly/v9 v9.10.0 h1:Emg9foA2+o7ERs7NVit18Wih8TEEOC+XEeb8Kcyehtw= +github.com/fastly/go-fastly/v9 v9.10.0/go.mod h1:5w2jgJBZqQEebOwM/rRg7wutAcpDTziiMYWb/6qdM7U= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/account_events.go b/vendor/github.com/fastly/go-fastly/v9/fastly/account_events.go index 39f89a79f..4de5705c2 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/account_events.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/account_events.go @@ -95,7 +95,8 @@ func (c *Client) GetAPIEvent(i *GetAPIEventInput) (*Event, error) { return nil, ErrMissingEventID } - path := fmt.Sprintf("/events/%s", i.EventID) + path := ToSafeURL("events", i.EventID) + resp, err := c.Get(path, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/acl.go b/vendor/github.com/fastly/go-fastly/v9/fastly/acl.go index 563617f90..f14723e28 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/acl.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/acl.go @@ -2,7 +2,7 @@ package fastly import ( "fmt" - "net/url" + "strconv" "time" ) @@ -34,7 +34,8 @@ func (c *Client) ListACLs(i *ListACLsInput) ([]*ACL, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/acl", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "acl") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -67,7 +68,8 @@ func (c *Client) CreateACL(i *CreateACLInput) (*ACL, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/acl", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "acl") + resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -103,7 +105,8 @@ func (c *Client) DeleteACL(i *DeleteACLInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/acl/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "acl", i.Name) + resp, err := c.Delete(path, nil) if err != nil { return err @@ -142,7 +145,8 @@ func (c *Client) GetACL(i *GetACLInput) (*ACL, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/acl/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "acl", i.Name) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -180,7 +184,8 @@ func (c *Client) UpdateACL(i *UpdateACLInput) (*ACL, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/acl/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "acl", i.Name) + resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/acl_entry.go b/vendor/github.com/fastly/go-fastly/v9/fastly/acl_entry.go index 105709c19..8dd1f2265 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/acl_entry.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/acl_entry.go @@ -19,8 +19,6 @@ type ACLEntry struct { UpdatedAt *time.Time `mapstructure:"updated_at"` } -const aclEntriesPath = "/service/%s/acl/%s/entries" - // GetACLEntriesInput is the input parameter to GetACLEntries function. type GetACLEntriesInput struct { // ACLID is an alphanumeric string identifying a ACL (required). @@ -52,7 +50,7 @@ func (c *Client) GetACLEntries(i *GetACLEntriesInput) *ListPaginator[ACLEntry] { if i.PerPage != nil { input.PerPage = *i.PerPage } - path := fmt.Sprintf(aclEntriesPath, i.ServiceID, i.ACLID) + path := ToSafeURL("service", i.ServiceID, "acl", i.ACLID, "entries") return NewPaginator[ACLEntry](c, input, path) } @@ -115,7 +113,7 @@ func (c *Client) GetACLEntry(i *GetACLEntryInput) (*ACLEntry, error) { return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/acl/%s/entry/%s", i.ServiceID, i.ACLID, i.EntryID) + path := ToSafeURL("service", i.ServiceID, "acl", i.ACLID, "entry", i.EntryID) resp, err := c.Get(path, nil) if err != nil { @@ -156,7 +154,7 @@ func (c *Client) CreateACLEntry(i *CreateACLEntryInput) (*ACLEntry, error) { return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/acl/%s/entry", i.ServiceID, i.ACLID) + path := ToSafeURL("service", i.ServiceID, "acl", i.ACLID, "entry") resp, err := c.PostForm(path, i, nil) if err != nil { @@ -194,7 +192,7 @@ func (c *Client) DeleteACLEntry(i *DeleteACLEntryInput) error { return ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/acl/%s/entry/%s", i.ServiceID, i.ACLID, i.EntryID) + path := ToSafeURL("service", i.ServiceID, "acl", i.ACLID, "entry", i.EntryID) resp, err := c.Delete(path, nil) if err != nil { @@ -244,7 +242,7 @@ func (c *Client) UpdateACLEntry(i *UpdateACLEntryInput) (*ACLEntry, error) { return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/acl/%s/entry/%s", i.ServiceID, i.ACLID, i.EntryID) + path := ToSafeURL("service", i.ServiceID, "acl", i.ACLID, "entry", i.EntryID) resp, err := c.RequestForm("PATCH", path, i, nil) if err != nil { @@ -299,7 +297,8 @@ func (c *Client) BatchModifyACLEntries(i *BatchModifyACLEntriesInput) error { return ErrMaxExceededEntries } - path := fmt.Sprintf(aclEntriesPath, i.ServiceID, i.ACLID) + path := ToSafeURL("service", i.ServiceID, "acl", i.ACLID, "entries") + resp, err := c.PatchJSON(path, i, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/alerts.go b/vendor/github.com/fastly/go-fastly/v9/fastly/alerts.go index 8ef210813..396f72cce 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/alerts.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/alerts.go @@ -2,7 +2,6 @@ package fastly import ( "encoding/json" - "fmt" "net/http" "strconv" "time" @@ -151,7 +150,8 @@ func (c *Client) GetAlertDefinition(i *GetAlertDefinitionInput) (*AlertDefinitio return nil, ErrMissingID } - path := fmt.Sprintf("/alerts/definitions/%s", *i.ID) + path := ToSafeURL("alerts", "definitions", *i.ID) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -190,7 +190,8 @@ func (c *Client) UpdateAlertDefinition(i *UpdateAlertDefinitionInput) (*AlertDef return nil, ErrMissingID } - path := fmt.Sprintf("/alerts/definitions/%s", *i.ID) + path := ToSafeURL("alerts", "definitions", *i.ID) + resp, err := c.PutJSON(path, i, nil) if err != nil { return nil, err @@ -216,7 +217,8 @@ func (c *Client) DeleteAlertDefinition(i *DeleteAlertDefinitionInput) error { return ErrMissingID } - path := fmt.Sprintf("/alerts/definitions/%s", *i.ID) + path := ToSafeURL("alerts", "definitions", *i.ID) + resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/backend.go b/vendor/github.com/fastly/go-fastly/v9/fastly/backend.go index 6015ed81a..4f041d159 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/backend.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/backend.go @@ -2,7 +2,7 @@ package fastly import ( "fmt" - "net/url" + "strconv" "time" ) @@ -64,7 +64,8 @@ func (c *Client) ListBackends(i *ListBackendsInput) ([]*Backend, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/backend", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "backend") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -157,7 +158,8 @@ func (c *Client) CreateBackend(i *CreateBackendInput) (*Backend, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/backend", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "backend") + resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -193,7 +195,8 @@ func (c *Client) GetBackend(i *GetBackendInput) (*Backend, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/backend/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "backend", i.Name) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -291,7 +294,8 @@ func (c *Client) UpdateBackend(i *UpdateBackendInput) (*Backend, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/backend/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "backend", i.Name) + resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -327,7 +331,8 @@ func (c *Client) DeleteBackend(i *DeleteBackendInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/backend/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "backend", i.Name) + resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/billing.go b/vendor/github.com/fastly/go-fastly/v9/fastly/billing.go index ae7f52a3f..2e8923262 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/billing.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/billing.go @@ -2,6 +2,7 @@ package fastly import ( "fmt" + "strconv" "time" ) @@ -68,7 +69,8 @@ func (c *Client) GetBilling(i *GetBillingInput) (*Billing, error) { return nil, ErrMissingMonth } - path := fmt.Sprintf("/billing/year/%d/month/%02d", i.Year, i.Month) + path := ToSafeURL("billing", "year", strconv.Itoa(int(i.Year)), "month", fmt.Sprintf("%02d", i.Month)) + resp, err := c.Get(path, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/compute_package.go b/vendor/github.com/fastly/go-fastly/v9/fastly/compute_package.go index ab29e62c4..1d543c5f6 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/compute_package.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/compute_package.go @@ -3,8 +3,8 @@ package fastly import ( "bytes" "errors" - "fmt" "io" + "strconv" "time" ) @@ -107,7 +107,7 @@ func MakePackagePath(serviceID string, serviceVersion int) (string, error) { if serviceVersion == 0 { return "", ErrMissingServiceVersion } - return fmt.Sprintf("/service/%s/version/%d/package", serviceID, serviceVersion), nil + return ToSafeURL("service", serviceID, "version", strconv.Itoa(serviceVersion), "package"), nil } // PopulatePackage encapsulates the decoding of returned package data. diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/config_store.go b/vendor/github.com/fastly/go-fastly/v9/fastly/config_store.go index 20d363e0d..32d740ec2 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/config_store.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/config_store.go @@ -2,7 +2,6 @@ package fastly import ( "encoding/json" - "fmt" "sort" "time" ) @@ -68,7 +67,8 @@ func (c *Client) DeleteConfigStore(i *DeleteConfigStoreInput) error { return ErrMissingStoreID } - path := fmt.Sprintf("/resources/stores/config/%s", i.StoreID) + path := ToSafeURL("resources", "stores", "config", i.StoreID) + resp, err := c.Delete(path, &RequestOptions{ Headers: map[string]string{ "Accept": "application/json", @@ -97,7 +97,8 @@ func (c *Client) GetConfigStore(i *GetConfigStoreInput) (*ConfigStore, error) { return nil, ErrMissingStoreID } - path := fmt.Sprintf("/resources/stores/config/%s", i.StoreID) + path := ToSafeURL("resources", "stores", "config", i.StoreID) + resp, err := c.Get(path, &RequestOptions{ Headers: map[string]string{ "Accept": "application/json", @@ -129,7 +130,8 @@ func (c *Client) GetConfigStoreMetadata(i *GetConfigStoreMetadataInput) (*Config return nil, ErrMissingStoreID } - path := fmt.Sprintf("/resources/stores/config/%s/info", i.StoreID) + path := ToSafeURL("resources", "stores", "config", i.StoreID, "info") + resp, err := c.Get(path, &RequestOptions{ Headers: map[string]string{ "Accept": "application/json", @@ -200,7 +202,8 @@ func (c *Client) ListConfigStoreServices(i *ListConfigStoreServicesInput) ([]*Se return nil, ErrMissingStoreID } - path := fmt.Sprintf("/resources/stores/config/%s/services", i.StoreID) + path := ToSafeURL("resources", "stores", "config", i.StoreID, "services") + resp, err := c.Get(path, &RequestOptions{ Headers: map[string]string{ "Accept": "application/json", @@ -235,7 +238,8 @@ func (c *Client) UpdateConfigStore(i *UpdateConfigStoreInput) (*ConfigStore, err return nil, ErrMissingStoreID } - path := fmt.Sprintf("/resources/stores/config/%s", i.StoreID) + path := ToSafeURL("resources", "stores", "config", i.StoreID) + resp, err := c.PutForm(path, i, &RequestOptions{ Headers: map[string]string{ // PutForm adds the appropriate Content-Type header. diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/config_store_item.go b/vendor/github.com/fastly/go-fastly/v9/fastly/config_store_item.go index d7f4d3a53..9f870a518 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/config_store_item.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/config_store_item.go @@ -2,9 +2,7 @@ package fastly import ( "encoding/json" - "fmt" "net/http" - "net/url" "sort" "time" ) @@ -38,7 +36,8 @@ func (c *Client) CreateConfigStoreItem(i *CreateConfigStoreItemInput) (*ConfigSt return nil, ErrMissingStoreID } - path := fmt.Sprintf("/resources/stores/config/%s/item", i.StoreID) + path := ToSafeURL("resources", "stores", "config", i.StoreID, "item") + resp, err := c.PostForm(path, i, &RequestOptions{ Headers: map[string]string{ // PostForm adds the appropriate Content-Type header. @@ -76,7 +75,8 @@ func (c *Client) DeleteConfigStoreItem(i *DeleteConfigStoreItemInput) error { return ErrMissingKey } - path := fmt.Sprintf("/resources/stores/config/%s/item/%s", i.StoreID, url.PathEscape(i.Key)) + path := ToSafeURL("resources", "stores", "config", i.StoreID, "item", i.Key) + resp, err := c.Delete(path, &RequestOptions{ Headers: map[string]string{ "Accept": "application/json", @@ -110,7 +110,8 @@ func (c *Client) GetConfigStoreItem(i *GetConfigStoreItemInput) (*ConfigStoreIte return nil, ErrMissingKey } - path := fmt.Sprintf("/resources/stores/config/%s/item/%s", i.StoreID, url.PathEscape(i.Key)) + path := ToSafeURL("resources", "stores", "config", i.StoreID, "item", i.Key) + resp, err := c.Get(path, &RequestOptions{ Headers: map[string]string{ "Accept": "application/json", @@ -142,7 +143,8 @@ func (c *Client) ListConfigStoreItems(i *ListConfigStoreItemsInput) ([]*ConfigSt return nil, ErrMissingStoreID } - path := fmt.Sprintf("/resources/stores/config/%s/items", i.StoreID) + path := ToSafeURL("resources", "stores", "config", i.StoreID, "items") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -181,7 +183,7 @@ func (c *Client) UpdateConfigStoreItem(i *UpdateConfigStoreItemInput) (*ConfigSt return nil, ErrMissingKey } - path := fmt.Sprintf("/resources/stores/config/%s/item/%s", i.StoreID, url.PathEscape(i.Key)) + path := ToSafeURL("resources", "stores", "config", i.StoreID, "item", i.Key) var httpMethod string if i.Upsert { @@ -240,7 +242,8 @@ func (c *Client) BatchModifyConfigStoreItems(i *BatchModifyConfigStoreItemsInput return ErrMaxExceededItems } - path := fmt.Sprintf("/resources/stores/config/%s/items", i.StoreID) + path := ToSafeURL("resources", "stores", "config", i.StoreID, "items") + resp, err := c.PatchJSON(path, i, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/dictionary.go b/vendor/github.com/fastly/go-fastly/v9/fastly/dictionary.go index aa31ea77d..ffba312a6 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/dictionary.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/dictionary.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -35,7 +34,8 @@ func (c *Client) ListDictionaries(i *ListDictionariesInput) ([]*Dictionary, erro return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/dictionary", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "dictionary") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -70,7 +70,8 @@ func (c *Client) CreateDictionary(i *CreateDictionaryInput) (*Dictionary, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/dictionary", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "dictionary") + resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -106,7 +107,8 @@ func (c *Client) GetDictionary(i *GetDictionaryInput) (*Dictionary, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/dictionary/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "dictionary", i.Name) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -146,7 +148,8 @@ func (c *Client) UpdateDictionary(i *UpdateDictionaryInput) (*Dictionary, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/dictionary/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "dictionary", i.Name) + resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -182,7 +185,8 @@ func (c *Client) DeleteDictionary(i *DeleteDictionaryInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/dictionary/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "dictionary", i.Name) + resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/dictionary_info.go b/vendor/github.com/fastly/go-fastly/v9/fastly/dictionary_info.go index b2253312e..deecd8929 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/dictionary_info.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/dictionary_info.go @@ -1,7 +1,7 @@ package fastly import ( - "fmt" + "strconv" "time" ) @@ -37,7 +37,8 @@ func (c *Client) GetDictionaryInfo(i *GetDictionaryInfoInput) (*DictionaryInfo, return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/dictionary/%s/info", i.ServiceID, i.ServiceVersion, i.DictionaryID) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "dictionary", i.DictionaryID, "info") + resp, err := c.Get(path, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/dictionary_item.go b/vendor/github.com/fastly/go-fastly/v9/fastly/dictionary_item.go index 90e45c547..a3ad348ac 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/dictionary_item.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/dictionary_item.go @@ -2,12 +2,9 @@ package fastly import ( "fmt" - "net/url" "time" ) -const dictionaryItemsPath = "/service/%s/dictionary/%s/items" - // DictionaryItem represents a dictionary item response from the Fastly API. type DictionaryItem struct { CreatedAt *time.Time `mapstructure:"created_at"` @@ -50,7 +47,9 @@ func (c *Client) GetDictionaryItems(i *GetDictionaryItemsInput) *ListPaginator[D if i.PerPage != nil { input.PerPage = *i.PerPage } - path := fmt.Sprintf(dictionaryItemsPath, i.ServiceID, i.DictionaryID) + + path := ToSafeURL("service", i.ServiceID, "dictionary", i.DictionaryID, "items") + return NewPaginator[DictionaryItem](c, input, path) } @@ -113,7 +112,8 @@ func (c *Client) CreateDictionaryItem(i *CreateDictionaryItemInput) (*Dictionary return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/dictionary/%s/item", i.ServiceID, i.DictionaryID) + path := ToSafeURL("service", i.ServiceID, "dictionary", i.DictionaryID, "item") + resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -166,7 +166,8 @@ func (c *Client) GetDictionaryItem(i *GetDictionaryItemInput) (*DictionaryItem, return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/dictionary/%s/item/%s", i.ServiceID, i.DictionaryID, url.PathEscape(i.ItemKey)) + path := ToSafeURL("service", i.ServiceID, "dictionary", i.DictionaryID, "item", i.ItemKey) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -204,7 +205,8 @@ func (c *Client) UpdateDictionaryItem(i *UpdateDictionaryItemInput) (*Dictionary return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/dictionary/%s/item/%s", i.ServiceID, i.DictionaryID, url.PathEscape(i.ItemKey)) + path := ToSafeURL("service", i.ServiceID, "dictionary", i.DictionaryID, "item", i.ItemKey) + resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -251,7 +253,8 @@ func (c *Client) BatchModifyDictionaryItems(i *BatchModifyDictionaryItemsInput) return ErrMissingServiceID } - path := fmt.Sprintf(dictionaryItemsPath, i.ServiceID, i.DictionaryID) + path := ToSafeURL("service", i.ServiceID, "dictionary", i.DictionaryID, "items") + resp, err := c.PatchJSON(path, i, nil) if err != nil { return err @@ -284,7 +287,8 @@ func (c *Client) DeleteDictionaryItem(i *DeleteDictionaryItemInput) error { return ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/dictionary/%s/item/%s", i.ServiceID, i.DictionaryID, url.PathEscape(i.ItemKey)) + path := ToSafeURL("service", i.ServiceID, "dictionary", i.DictionaryID, "item", i.ItemKey) + resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/diff.go b/vendor/github.com/fastly/go-fastly/v9/fastly/diff.go index c9df4aca8..67e43117e 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/diff.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/diff.go @@ -1,6 +1,6 @@ package fastly -import "fmt" +import "strconv" // Diff represents a diff of two versions as a response from the Fastly API. type Diff struct { @@ -40,7 +40,8 @@ func (c *Client) GetDiff(i *GetDiffInput) (*Diff, error) { return nil, ErrMissingTo } - path := fmt.Sprintf("service/%s/diff/from/%d/to/%d", i.ServiceID, i.From, i.To) + path := ToSafeURL("service", i.ServiceID, "diff", "from", strconv.Itoa(i.From), "to", strconv.Itoa(i.To)) + resp, err := c.Get(path, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/domain.go b/vendor/github.com/fastly/go-fastly/v9/fastly/domain.go index dd0d867bd..4481ce577 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/domain.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/domain.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" "io" - "net/url" + "strconv" "time" ) @@ -36,7 +36,8 @@ func (c *Client) ListDomains(i *ListDomainsInput) ([]*Domain, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/domain", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "domain") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -71,7 +72,8 @@ func (c *Client) CreateDomain(i *CreateDomainInput) (*Domain, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/domain", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "domain") + resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -107,7 +109,8 @@ func (c *Client) GetDomain(i *GetDomainInput) (*Domain, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/domain/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "domain", i.Name) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -147,7 +150,8 @@ func (c *Client) UpdateDomain(i *UpdateDomainInput) (*Domain, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/domain/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "domain", i.Name) + resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -183,7 +187,8 @@ func (c *Client) DeleteDomain(i *DeleteDomainInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/domain/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "domain", i.Name) + _, err := c.Delete(path, nil) return err } @@ -210,7 +215,8 @@ func (c *Client) ValidateDomain(i *ValidateDomainInput) (*DomainValidationResult return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/domain/%s/check", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "domain", i.Name, "check") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -294,7 +300,8 @@ func (c *Client) ValidateAllDomains(i *ValidateAllDomainsInput) (results []*Doma return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/domain/check_all", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "domain", "check_all") + resp, err := c.Get(path, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/health_check.go b/vendor/github.com/fastly/go-fastly/v9/fastly/health_check.go index 02eb44ace..12550fa98 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/health_check.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/health_check.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -45,7 +44,8 @@ func (c *Client) ListHealthChecks(i *ListHealthChecksInput) ([]*HealthCheck, err return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/healthcheck", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "healthcheck") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -105,7 +105,8 @@ func (c *Client) CreateHealthCheck(i *CreateHealthCheckInput) (*HealthCheck, err ro := new(RequestOptions) ro.HealthCheckHeaders = true - path := fmt.Sprintf("/service/%s/version/%d/healthcheck", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "healthcheck") + resp, err := c.PostForm(path, i, ro) if err != nil { return nil, err @@ -141,7 +142,8 @@ func (c *Client) GetHealthCheck(i *GetHealthCheckInput) (*HealthCheck, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/healthcheck/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "healthcheck", i.Name) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -206,7 +208,8 @@ func (c *Client) UpdateHealthCheck(i *UpdateHealthCheckInput) (*HealthCheck, err ro := new(RequestOptions) ro.HealthCheckHeaders = true - path := fmt.Sprintf("/service/%s/version/%d/healthcheck/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "healthcheck", i.Name) + resp, err := c.PutForm(path, i, ro) if err != nil { return nil, err @@ -242,7 +245,8 @@ func (c *Client) DeleteHealthCheck(i *DeleteHealthCheckInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/healthcheck/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "healthcheck", i.Name) + resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/helpers.go b/vendor/github.com/fastly/go-fastly/v9/fastly/helpers.go index 3b5bb684c..c9d38a86d 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/helpers.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/helpers.go @@ -1,5 +1,7 @@ package fastly +import "net/url" + // MultiConstraint is a generic constraint for ToPointer/ToValue. type MultiConstraint interface { []string | ~string | ~int | int32 | ~int64 | uint | uint8 | uint32 | uint64 | float64 | ~bool @@ -31,3 +33,26 @@ func NullString(v string) *string { } return &v } + +// ToSafeURL produces a safe (no path traversal, no unsafe characters) URL +// from the path components passed in. +// +// Unlike the normal behavior of url.JoinPath, this function skips +// ".." components, ensuring that user-provided components cannot +// remove code-provided components from the resulting path. +func ToSafeURL(unsafeComponents ...string) string { + safeComponents := make([]string, len(unsafeComponents)) + + for i := range unsafeComponents { + if unsafeComponents[i] != ".." { + safeComponents[i] = url.PathEscape(unsafeComponents[i]) + } + } + + // it is safe to ignore the error returned from JoinPath + // because the only time it will be non-nil is if parsing + // the base path fails, but that will not fail since it is + // a constant "/" string + result, _ := url.JoinPath("/", safeComponents...) + return result +} diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/image_optimizer_default_settings.go b/vendor/github.com/fastly/go-fastly/v9/fastly/image_optimizer_default_settings.go index 0e352547c..fee2647f3 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/image_optimizer_default_settings.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/image_optimizer_default_settings.go @@ -2,7 +2,7 @@ package fastly import ( "encoding/json" - "fmt" + "strconv" ) // ImageOptimizerResizeFilter is a base for the different ImageOptimizerResizeFilter variants. @@ -132,7 +132,7 @@ func (c *Client) GetImageOptimizerDefaultSettings(i *GetImageOptimizerDefaultSet return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/image_optimizer_default_settings", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "image_optimizer_default_settings") resp, err := c.Get(path, nil) if err != nil { @@ -170,7 +170,7 @@ func (c *Client) UpdateImageOptimizerDefaultSettings(i *UpdateImageOptimizerDefa return nil, ErrMissingImageOptimizerDefaultSetting } - path := fmt.Sprintf("/service/%s/version/%d/image_optimizer_default_settings", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "image_optimizer_default_settings") resp, err := c.PatchJSON(path, i, nil) if err != nil { diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/kv_store.go b/vendor/github.com/fastly/go-fastly/v9/fastly/kv_store.go index 64e624394..b7be19c10 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/kv_store.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/kv_store.go @@ -178,7 +178,8 @@ func (c *Client) GetKVStore(i *GetKVStoreInput) (*KVStore, error) { return nil, ErrMissingStoreID } - path := "/resources/stores/kv/" + i.StoreID + path := ToSafeURL("resources", "stores", "kv", i.StoreID) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -204,7 +205,8 @@ func (c *Client) DeleteKVStore(i *DeleteKVStoreInput) error { return ErrMissingStoreID } - path := "/resources/stores/kv/" + i.StoreID + path := ToSafeURL("resources", "stores", "kv", i.StoreID) + resp, err := c.Delete(path, nil) if err != nil { return err @@ -282,7 +284,8 @@ func (c *Client) ListKVStoreKeys(i *ListKVStoreKeysInput) (*ListKVStoreKeysRespo return nil, ErrMissingStoreID } - path := "/resources/stores/kv/" + i.StoreID + "/keys" + path := ToSafeURL("resources", "stores", "kv", i.StoreID, "keys") + ro := new(RequestOptions) ro.Params = i.formatFilters() @@ -369,7 +372,8 @@ func (c *Client) GetKVStoreKey(i *GetKVStoreKeyInput) (string, error) { return "", ErrMissingKey } - path := "/resources/stores/kv/" + i.StoreID + "/keys/" + i.Key + path := ToSafeURL("resources", "stores", "kv", i.StoreID, "keys", i.Key) + resp, err := c.Get(path, nil) if err != nil { return "", err @@ -451,7 +455,8 @@ func (c *Client) InsertKVStoreKey(i *InsertKVStoreKeyInput) error { ro.BodyLength = int64(len(i.Value)) } - path := "/resources/stores/kv/" + i.StoreID + "/keys/" + i.Key + path := ToSafeURL("resources", "stores", "kv", i.StoreID, "keys", i.Key) + resp, err := c.Put(path, &ro) if err != nil { return err @@ -483,7 +488,8 @@ func (c *Client) DeleteKVStoreKey(i *DeleteKVStoreKeyInput) error { Parallel: true, // This will allow the Fastly CLI to make bulk deletes. } - path := "/resources/stores/kv/" + i.StoreID + "/keys/" + i.Key + path := ToSafeURL("resources", "stores", "kv", i.StoreID, "keys", i.Key) + resp, err := c.Delete(path, &ro) if err != nil { return err @@ -514,7 +520,8 @@ func (c *Client) BatchModifyKVStoreKey(i *BatchModifyKVStoreKeyInput) error { return ErrMissingStoreID } - path := "/resources/stores/kv/" + i.StoreID + "/batch" + path := ToSafeURL("resources", "stores", "kv", i.StoreID, "batch") + resp, err := c.Put(path, &RequestOptions{ Body: bufio.NewReader(i.Body), Headers: map[string]string{ diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/load_balance_pool.go b/vendor/github.com/fastly/go-fastly/v9/fastly/load_balance_pool.go index 14e7fac54..9621ff9a2 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/load_balance_pool.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/load_balance_pool.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -68,7 +67,8 @@ func (c *Client) ListPools(i *ListPoolsInput) ([]*Pool, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/pool", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "pool") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -141,7 +141,7 @@ func (c *Client) CreatePool(i *CreatePoolInput) (*Pool, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/pool", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "pool") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -177,7 +177,8 @@ func (c *Client) GetPool(i *GetPoolInput) (*Pool, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/pool/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "pool", i.Name) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -255,7 +256,8 @@ func (c *Client) UpdatePool(i *UpdatePoolInput) (*Pool, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/pool/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "pool", i.Name) + resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -291,7 +293,8 @@ func (c *Client) DeletePool(i *DeletePoolInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/pool/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "pool", i.Name) + resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/load_balancer_director.go b/vendor/github.com/fastly/go-fastly/v9/fastly/load_balancer_director.go index 043746b30..fbe275cd8 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/load_balancer_director.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/load_balancer_director.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -57,7 +56,7 @@ func (c *Client) ListDirectors(i *ListDirectorsInput) ([]*Director, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/director", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "director") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -100,7 +99,7 @@ func (c *Client) CreateDirector(i *CreateDirectorInput) (*Director, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/director", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "director") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -136,7 +135,7 @@ func (c *Client) GetDirector(i *GetDirectorInput) (*Director, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/director/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "director", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -184,7 +183,7 @@ func (c *Client) UpdateDirector(i *UpdateDirectorInput) (*Director, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/director/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "director", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -220,7 +219,7 @@ func (c *Client) DeleteDirector(i *DeleteDirectorInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/director/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "director", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/load_balancer_director_backend.go b/vendor/github.com/fastly/go-fastly/v9/fastly/load_balancer_director_backend.go index 0bfc6ea7d..d38fcacd3 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/load_balancer_director_backend.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/load_balancer_director_backend.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -46,8 +45,7 @@ func (c *Client) CreateDirectorBackend(i *CreateDirectorBackendInput) (*Director return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/director/%s/backend/%s", - i.ServiceID, i.ServiceVersion, url.PathEscape(i.Director), url.PathEscape(i.Backend)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "director", i.Director, "backend", i.Backend) resp, err := c.PostForm(path, i, nil) if err != nil { @@ -89,8 +87,7 @@ func (c *Client) GetDirectorBackend(i *GetDirectorBackendInput) (*DirectorBacken return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/director/%s/backend/%s", - i.ServiceID, i.ServiceVersion, url.PathEscape(i.Director), url.PathEscape(i.Backend)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "director", i.Director, "backend", i.Backend) resp, err := c.Get(path, nil) if err != nil { @@ -132,8 +129,7 @@ func (c *Client) DeleteDirectorBackend(i *DeleteDirectorBackendInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/director/%s/backend/%s", - i.ServiceID, i.ServiceVersion, url.PathEscape(i.Director), url.PathEscape(i.Backend)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "director", i.Director, "backend", i.Backend) resp, err := c.Delete(path, nil) if err != nil { diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/load_balancer_server.go b/vendor/github.com/fastly/go-fastly/v9/fastly/load_balancer_server.go index 124e644cf..cee9186b5 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/load_balancer_server.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/load_balancer_server.go @@ -1,7 +1,6 @@ package fastly import ( - "fmt" "time" ) @@ -39,7 +38,8 @@ func (c *Client) ListServers(i *ListServersInput) ([]*Server, error) { return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/pool/%s/servers", i.ServiceID, i.PoolID) + path := ToSafeURL("service", i.ServiceID, "pool", i.PoolID, "servers") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -85,7 +85,8 @@ func (c *Client) CreateServer(i *CreateServerInput) (*Server, error) { return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/pool/%s/server", i.ServiceID, i.PoolID) + path := ToSafeURL("service", i.ServiceID, "pool", i.PoolID, "server") + resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -121,7 +122,8 @@ func (c *Client) GetServer(i *GetServerInput) (*Server, error) { return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/pool/%s/server/%s", i.ServiceID, i.PoolID, i.Server) + path := ToSafeURL("service", i.ServiceID, "pool", i.PoolID, "server", i.Server) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -171,7 +173,8 @@ func (c *Client) UpdateServer(i *UpdateServerInput) (*Server, error) { return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/pool/%s/server/%s", i.ServiceID, i.PoolID, i.Server) + path := ToSafeURL("service", i.ServiceID, "pool", i.PoolID, "server", i.Server) + resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -207,7 +210,8 @@ func (c *Client) DeleteServer(i *DeleteServerInput) error { return ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/pool/%s/server/%s", i.ServiceID, i.PoolID, i.Server) + path := ToSafeURL("service", i.ServiceID, "pool", i.PoolID, "server", i.Server) + resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_bigquery.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_bigquery.go index 1ae9110da..7d454f0c3 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_bigquery.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_bigquery.go @@ -2,7 +2,7 @@ package fastly import ( "fmt" - "net/url" + "strconv" "time" ) @@ -44,7 +44,7 @@ func (c *Client) ListBigQueries(i *ListBigQueriesInput) ([]*BigQuery, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/bigquery", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "bigquery") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -99,7 +99,7 @@ func (c *Client) CreateBigQuery(i *CreateBigQueryInput) (*BigQuery, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/bigquery", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "bigquery") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -135,7 +135,7 @@ func (c *Client) GetBigQuery(i *GetBigQueryInput) (*BigQuery, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/bigquery/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "bigquery", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -195,7 +195,7 @@ func (c *Client) UpdateBigQuery(i *UpdateBigQueryInput) (*BigQuery, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/bigquery/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "bigquery", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -231,7 +231,7 @@ func (c *Client) DeleteBigQuery(i *DeleteBigQueryInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/bigquery/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "bigquery", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_blobstorage.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_blobstorage.go index da8123825..a8fc9e83a 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_blobstorage.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_blobstorage.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -48,7 +47,7 @@ func (c *Client) ListBlobStorages(i *ListBlobStoragesInput) ([]*BlobStorage, err return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/azureblob", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "azureblob") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -111,7 +110,7 @@ func (c *Client) CreateBlobStorage(i *CreateBlobStorageInput) (*BlobStorage, err return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/azureblob", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "azureblob") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -147,7 +146,7 @@ func (c *Client) GetBlobStorage(i *GetBlobStorageInput) (*BlobStorage, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/azureblob/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "azureblob", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -215,7 +214,7 @@ func (c *Client) UpdateBlobStorage(i *UpdateBlobStorageInput) (*BlobStorage, err return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/azureblob/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "azureblob", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -251,7 +250,7 @@ func (c *Client) DeleteBlobStorage(i *DeleteBlobStorageInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/azureblob/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "azureblob", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_cloudfiles.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_cloudfiles.go index b7662b95d..6cc6fab08 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_cloudfiles.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_cloudfiles.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -48,7 +47,7 @@ func (c *Client) ListCloudfiles(i *ListCloudfilesInput) ([]*Cloudfiles, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/cloudfiles", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "cloudfiles") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -111,7 +110,7 @@ func (c *Client) CreateCloudfiles(i *CreateCloudfilesInput) (*Cloudfiles, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/cloudfiles", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "cloudfiles") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -147,7 +146,7 @@ func (c *Client) GetCloudfiles(i *GetCloudfilesInput) (*Cloudfiles, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/cloudfiles/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "cloudfiles", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -215,7 +214,7 @@ func (c *Client) UpdateCloudfiles(i *UpdateCloudfilesInput) (*Cloudfiles, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/cloudfiles/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "cloudfiles", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -251,7 +250,7 @@ func (c *Client) DeleteCloudfiles(i *DeleteCloudfilesInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/cloudfiles/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "cloudfiles", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_datadog.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_datadog.go index 5dc424158..e9fc96462 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_datadog.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_datadog.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -39,7 +38,7 @@ func (c *Client) ListDatadog(i *ListDatadogInput) ([]*Datadog, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/datadog", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "datadog") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -84,7 +83,7 @@ func (c *Client) CreateDatadog(i *CreateDatadogInput) (*Datadog, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/datadog", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "datadog") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -120,7 +119,7 @@ func (c *Client) GetDatadog(i *GetDatadogInput) (*Datadog, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/datadog/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "datadog", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -170,7 +169,7 @@ func (c *Client) UpdateDatadog(i *UpdateDatadogInput) (*Datadog, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/datadog/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "datadog", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -206,7 +205,7 @@ func (c *Client) DeleteDatadog(i *DeleteDatadogInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/datadog/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "datadog", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_digitalocean.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_digitalocean.go index 3f1cdf08a..db2e57a36 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_digitalocean.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_digitalocean.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -48,7 +47,7 @@ func (c *Client) ListDigitalOceans(i *ListDigitalOceansInput) ([]*DigitalOcean, return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/digitalocean", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "digitalocean") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -111,7 +110,7 @@ func (c *Client) CreateDigitalOcean(i *CreateDigitalOceanInput) (*DigitalOcean, return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/digitalocean", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "digitalocean") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -147,7 +146,7 @@ func (c *Client) GetDigitalOcean(i *GetDigitalOceanInput) (*DigitalOcean, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/digitalocean/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "digitalocean", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -215,7 +214,7 @@ func (c *Client) UpdateDigitalOcean(i *UpdateDigitalOceanInput) (*DigitalOcean, return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/digitalocean/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "digitalocean", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -251,7 +250,7 @@ func (c *Client) DeleteDigitalOcean(i *DeleteDigitalOceanInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/digitalocean/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "digitalocean", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_elasticsearch.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_elasticsearch.go index 8ddca69db..20b3e0338 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_elasticsearch.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_elasticsearch.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -48,7 +47,7 @@ func (c *Client) ListElasticsearch(i *ListElasticsearchInput) ([]*Elasticsearch, return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/elasticsearch", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "elasticsearch") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -111,7 +110,7 @@ func (c *Client) CreateElasticsearch(i *CreateElasticsearchInput) (*Elasticsearc return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/elasticsearch", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "elasticsearch") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -147,7 +146,7 @@ func (c *Client) GetElasticsearch(i *GetElasticsearchInput) (*Elasticsearch, err return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/elasticsearch/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "elasticsearch", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -217,7 +216,7 @@ func (c *Client) UpdateElasticsearch(i *UpdateElasticsearchInput) (*Elasticsearc return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/elasticsearch/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "elasticsearch", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -254,7 +253,7 @@ func (c *Client) DeleteElasticsearch(i *DeleteElasticsearchInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/elasticsearch/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "elasticsearch", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_ftp.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_ftp.go index 08a210157..04ca012e0 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_ftp.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_ftp.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -48,7 +47,7 @@ func (c *Client) ListFTPs(i *ListFTPsInput) ([]*FTP, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/ftp", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "ftp") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -111,7 +110,7 @@ func (c *Client) CreateFTP(i *CreateFTPInput) (*FTP, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/ftp", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "ftp") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -147,7 +146,7 @@ func (c *Client) GetFTP(i *GetFTPInput) (*FTP, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/ftp/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "ftp", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -215,7 +214,7 @@ func (c *Client) UpdateFTP(i *UpdateFTPInput) (*FTP, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/ftp/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "ftp", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -251,7 +250,7 @@ func (c *Client) DeleteFTP(i *DeleteFTPInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/ftp/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "ftp", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_gcs.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_gcs.go index e96eb059b..d93592b5e 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_gcs.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_gcs.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -48,7 +47,7 @@ func (c *Client) ListGCSs(i *ListGCSsInput) ([]*GCS, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/gcs", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "gcs") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -111,7 +110,7 @@ func (c *Client) CreateGCS(i *CreateGCSInput) (*GCS, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/gcs", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "gcs") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -147,7 +146,7 @@ func (c *Client) GetGCS(i *GetGCSInput) (*GCS, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/gcs/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "gcs", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -215,7 +214,7 @@ func (c *Client) UpdateGCS(i *UpdateGCSInput) (*GCS, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/gcs/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "gcs", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -251,7 +250,7 @@ func (c *Client) DeleteGCS(i *DeleteGCSInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/gcs/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "gcs", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_heroku.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_heroku.go index b6cbaf33c..12c06bbcc 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_heroku.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_heroku.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -39,7 +38,7 @@ func (c *Client) ListHerokus(i *ListHerokusInput) ([]*Heroku, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/heroku", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "heroku") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -84,7 +83,7 @@ func (c *Client) CreateHeroku(i *CreateHerokuInput) (*Heroku, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/heroku", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "heroku") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -120,7 +119,7 @@ func (c *Client) GetHeroku(i *GetHerokuInput) (*Heroku, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/heroku/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "heroku", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -170,7 +169,7 @@ func (c *Client) UpdateHeroku(i *UpdateHerokuInput) (*Heroku, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/heroku/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "heroku", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -206,7 +205,7 @@ func (c *Client) DeleteHeroku(i *DeleteHerokuInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/heroku/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "heroku", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_honeycomb.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_honeycomb.go index ad5393cdd..0bd6555f9 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_honeycomb.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_honeycomb.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -39,7 +38,7 @@ func (c *Client) ListHoneycombs(i *ListHoneycombsInput) ([]*Honeycomb, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/honeycomb", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "honeycomb") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -84,7 +83,7 @@ func (c *Client) CreateHoneycomb(i *CreateHoneycombInput) (*Honeycomb, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/honeycomb", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "honeycomb") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -120,7 +119,7 @@ func (c *Client) GetHoneycomb(i *GetHoneycombInput) (*Honeycomb, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/honeycomb/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "honeycomb", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -170,7 +169,7 @@ func (c *Client) UpdateHoneycomb(i *UpdateHoneycombInput) (*Honeycomb, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/honeycomb/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "honeycomb", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -206,7 +205,7 @@ func (c *Client) DeleteHoneycomb(i *DeleteHoneycombInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/honeycomb/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "honeycomb", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_https.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_https.go index b2d17306d..5f1befc5b 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_https.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_https.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -50,7 +49,7 @@ func (c *Client) ListHTTPS(i *ListHTTPSInput) ([]*HTTPS, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/https", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "https") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -117,7 +116,7 @@ func (c *Client) CreateHTTPS(i *CreateHTTPSInput) (*HTTPS, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/https", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "https") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -153,7 +152,7 @@ func (c *Client) GetHTTPS(i *GetHTTPSInput) (*HTTPS, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/https/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "https", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -226,7 +225,7 @@ func (c *Client) UpdateHTTPS(i *UpdateHTTPSInput) (*HTTPS, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/https/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "https", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -262,7 +261,7 @@ func (c *Client) DeleteHTTPS(i *DeleteHTTPSInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/https/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "https", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_kafka.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_kafka.go index c333053ee..9bab65bff 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_kafka.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_kafka.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -51,7 +50,7 @@ func (c *Client) ListKafkas(i *ListKafkasInput) ([]*Kafka, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/kafka", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "kafka") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -120,7 +119,7 @@ func (c *Client) CreateKafka(i *CreateKafkaInput) (*Kafka, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/kafka", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "kafka") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -156,7 +155,7 @@ func (c *Client) GetKafka(i *GetKafkaInput) (*Kafka, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/kafka/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "kafka", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -230,7 +229,7 @@ func (c *Client) UpdateKafka(i *UpdateKafkaInput) (*Kafka, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/kafka/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "kafka", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -266,7 +265,7 @@ func (c *Client) DeleteKafka(i *DeleteKafkaInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/kafka/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "kafka", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_kinesis.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_kinesis.go index 6a2bfdd7f..12adc274e 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_kinesis.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_kinesis.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -42,7 +41,7 @@ func (c *Client) ListKinesis(i *ListKinesisInput) ([]*Kinesis, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/kinesis", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "kinesis") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -93,7 +92,7 @@ func (c *Client) CreateKinesis(i *CreateKinesisInput) (*Kinesis, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/kinesis", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "kinesis") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -129,7 +128,7 @@ func (c *Client) GetKinesis(i *GetKinesisInput) (*Kinesis, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/kinesis/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "kinesis", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -185,7 +184,7 @@ func (c *Client) UpdateKinesis(i *UpdateKinesisInput) (*Kinesis, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/kinesis/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "kinesis", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -221,7 +220,7 @@ func (c *Client) DeleteKinesis(i *DeleteKinesisInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/kinesis/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "kinesis", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_logentries.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_logentries.go index 36957027a..f349b41d1 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_logentries.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_logentries.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -41,7 +40,7 @@ func (c *Client) ListLogentries(i *ListLogentriesInput) ([]*Logentries, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/logentries", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "logentries") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -90,7 +89,7 @@ func (c *Client) CreateLogentries(i *CreateLogentriesInput) (*Logentries, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/logentries", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "logentries") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -126,7 +125,7 @@ func (c *Client) GetLogentries(i *GetLogentriesInput) (*Logentries, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/logentries/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "logentries", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -180,7 +179,7 @@ func (c *Client) UpdateLogentries(i *UpdateLogentriesInput) (*Logentries, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/logentries/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "logentries", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -216,7 +215,7 @@ func (c *Client) DeleteLogentries(i *DeleteLogentriesInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/logentries/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "logentries", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_loggly.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_loggly.go index 49138fc2f..2c033d67a 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_loggly.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_loggly.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -38,7 +37,7 @@ func (c *Client) ListLoggly(i *ListLogglyInput) ([]*Loggly, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/loggly", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "loggly") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -81,7 +80,7 @@ func (c *Client) CreateLoggly(i *CreateLogglyInput) (*Loggly, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/loggly", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "loggly") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -117,7 +116,7 @@ func (c *Client) GetLoggly(i *GetLogglyInput) (*Loggly, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/loggly/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "loggly", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -165,7 +164,7 @@ func (c *Client) UpdateLoggly(i *UpdateLogglyInput) (*Loggly, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/loggly/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "loggly", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -201,7 +200,7 @@ func (c *Client) DeleteLoggly(i *DeleteLogglyInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/loggly/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "loggly", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_logshuttle.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_logshuttle.go index 579927a65..0fa83a88a 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_logshuttle.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_logshuttle.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -39,7 +38,7 @@ func (c *Client) ListLogshuttles(i *ListLogshuttlesInput) ([]*Logshuttle, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/logshuttle", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "logshuttle") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -84,7 +83,7 @@ func (c *Client) CreateLogshuttle(i *CreateLogshuttleInput) (*Logshuttle, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/logshuttle", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "logshuttle") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -120,7 +119,7 @@ func (c *Client) GetLogshuttle(i *GetLogshuttleInput) (*Logshuttle, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/logshuttle/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "logshuttle", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -170,7 +169,7 @@ func (c *Client) UpdateLogshuttle(i *UpdateLogshuttleInput) (*Logshuttle, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/logshuttle/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "logshuttle", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -206,7 +205,7 @@ func (c *Client) DeleteLogshuttle(i *DeleteLogshuttleInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/logshuttle/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "logshuttle", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_newrelic.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_newrelic.go index edc3e45b7..fb923449e 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_newrelic.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_newrelic.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -39,7 +38,7 @@ func (c *Client) ListNewRelic(i *ListNewRelicInput) ([]*NewRelic, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/newrelic", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "newrelic") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -84,7 +83,7 @@ func (c *Client) CreateNewRelic(i *CreateNewRelicInput) (*NewRelic, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/newrelic", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "newrelic") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -120,7 +119,7 @@ func (c *Client) GetNewRelic(i *GetNewRelicInput) (*NewRelic, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/newrelic/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "newrelic", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -170,7 +169,7 @@ func (c *Client) UpdateNewRelic(i *UpdateNewRelicInput) (*NewRelic, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/newrelic/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "newrelic", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -206,7 +205,7 @@ func (c *Client) DeleteNewRelic(i *DeleteNewRelicInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/newrelic/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "newrelic", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_newrelicotlp.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_newrelicotlp.go index 2ebec06d5..a85adc94d 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_newrelicotlp.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_newrelicotlp.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -42,7 +41,7 @@ func (c *Client) ListNewRelicOTLP(i *ListNewRelicOTLPInput) ([]*NewRelicOTLP, er return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/newrelicotlp", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "newrelicotlp") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -90,7 +89,7 @@ func (c *Client) CreateNewRelicOTLP(i *CreateNewRelicOTLPInput) (*NewRelicOTLP, return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/newrelicotlp", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "newrelicotlp") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -126,7 +125,7 @@ func (c *Client) GetNewRelicOTLP(i *GetNewRelicOTLPInput) (*NewRelicOTLP, error) return nil, ErrMissingName } - path := fmt.Sprintf("/service/%s/version/%d/logging/newrelicotlp/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "newrelicotlp", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -179,7 +178,7 @@ func (c *Client) UpdateNewRelicOTLP(i *UpdateNewRelicOTLPInput) (*NewRelicOTLP, return nil, ErrMissingName } - path := fmt.Sprintf("/service/%s/version/%d/logging/newrelicotlp/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "newrelicotlp", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -215,7 +214,7 @@ func (c *Client) DeleteNewRelicOTLP(i *DeleteNewRelicOTLPInput) error { return ErrMissingName } - path := fmt.Sprintf("/service/%s/version/%d/logging/newrelicotlp/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "newrelicotlp", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_openstack.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_openstack.go index 5d47b0622..7ce544c6c 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_openstack.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_openstack.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -48,7 +47,7 @@ func (c *Client) ListOpenstack(i *ListOpenstackInput) ([]*Openstack, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/openstack", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "openstack") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -111,7 +110,7 @@ func (c *Client) CreateOpenstack(i *CreateOpenstackInput) (*Openstack, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/openstack", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "openstack") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -147,7 +146,7 @@ func (c *Client) GetOpenstack(i *GetOpenstackInput) (*Openstack, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/openstack/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "openstack", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -215,7 +214,7 @@ func (c *Client) UpdateOpenstack(i *UpdateOpenstackInput) (*Openstack, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/openstack/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "openstack", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -251,7 +250,7 @@ func (c *Client) DeleteOpenstack(i *DeleteOpenstackInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/openstack/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "openstack", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_papertrail.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_papertrail.go index 3e7c13d7f..739c0914f 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_papertrail.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_papertrail.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -39,7 +38,7 @@ func (c *Client) ListPapertrails(i *ListPapertrailsInput) ([]*Papertrail, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/papertrail", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "papertrail") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -84,7 +83,7 @@ func (c *Client) CreatePapertrail(i *CreatePapertrailInput) (*Papertrail, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/papertrail", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "papertrail") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -120,7 +119,7 @@ func (c *Client) GetPapertrail(i *GetPapertrailInput) (*Papertrail, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/papertrail/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "papertrail", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -170,7 +169,7 @@ func (c *Client) UpdatePapertrail(i *UpdatePapertrailInput) (*Papertrail, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/papertrail/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "papertrail", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -206,7 +205,7 @@ func (c *Client) DeletePapertrail(i *DeletePapertrailInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/papertrail/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "papertrail", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_pubsub.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_pubsub.go index a148b9c59..5f21218d5 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_pubsub.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_pubsub.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -42,7 +41,7 @@ func (c *Client) ListPubsubs(i *ListPubsubsInput) ([]*Pubsub, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/pubsub", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "pubsub") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -93,7 +92,7 @@ func (c *Client) CreatePubsub(i *CreatePubsubInput) (*Pubsub, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/pubsub", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "pubsub") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -129,7 +128,7 @@ func (c *Client) GetPubsub(i *GetPubsubInput) (*Pubsub, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/pubsub/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "pubsub", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -185,7 +184,7 @@ func (c *Client) UpdatePubsub(i *UpdatePubsubInput) (*Pubsub, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/pubsub/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "pubsub", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -221,7 +220,7 @@ func (c *Client) DeletePubsub(i *DeletePubsubInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/pubsub/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "pubsub", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_s3.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_s3.go index f397962c3..ecb2c1988 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_s3.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_s3.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -102,7 +101,7 @@ func (c *Client) ListS3s(i *ListS3sInput) ([]*S3, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/s3", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "s3") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -183,7 +182,7 @@ func (c *Client) CreateS3(i *CreateS3Input) (*S3, error) { return nil, ErrMissingServerSideEncryptionKMSKeyID } - path := fmt.Sprintf("/service/%s/version/%d/logging/s3", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "s3") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -219,7 +218,7 @@ func (c *Client) GetS3(i *GetS3Input) (*S3, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/s3/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "s3", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -305,7 +304,7 @@ func (c *Client) UpdateS3(i *UpdateS3Input) (*S3, error) { return nil, ErrMissingServerSideEncryptionKMSKeyID } - path := fmt.Sprintf("/service/%s/version/%d/logging/s3/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "s3", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -341,7 +340,7 @@ func (c *Client) DeleteS3(i *DeleteS3Input) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/s3/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "s3", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_scalyr.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_scalyr.go index 6ddedfaa9..a83148963 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_scalyr.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_scalyr.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -40,7 +39,7 @@ func (c *Client) ListScalyrs(i *ListScalyrsInput) ([]*Scalyr, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/scalyr", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "scalyr") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -87,7 +86,7 @@ func (c *Client) CreateScalyr(i *CreateScalyrInput) (*Scalyr, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/scalyr", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "scalyr") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -123,7 +122,7 @@ func (c *Client) GetScalyr(i *GetScalyrInput) (*Scalyr, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/scalyr/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "scalyr", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -175,7 +174,7 @@ func (c *Client) UpdateScalyr(i *UpdateScalyrInput) (*Scalyr, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/scalyr/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "scalyr", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -211,7 +210,7 @@ func (c *Client) DeleteScalyr(i *DeleteScalyrInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/scalyr/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "scalyr", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_sftp.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_sftp.go index 2ad7861d4..6bef274fc 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_sftp.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_sftp.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -50,7 +49,7 @@ func (c *Client) ListSFTPs(i *ListSFTPsInput) ([]*SFTP, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/sftp", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "sftp") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -117,7 +116,7 @@ func (c *Client) CreateSFTP(i *CreateSFTPInput) (*SFTP, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/sftp", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "sftp") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -153,7 +152,7 @@ func (c *Client) GetSFTP(i *GetSFTPInput) (*SFTP, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/sftp/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "sftp", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -225,7 +224,7 @@ func (c *Client) UpdateSFTP(i *UpdateSFTPInput) (*SFTP, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/sftp/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "sftp", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -261,7 +260,7 @@ func (c *Client) DeleteSFTP(i *DeleteSFTPInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/sftp/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "sftp", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_splunk.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_splunk.go index 9e9faffdf..a3f9340ad 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_splunk.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_splunk.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -46,7 +45,7 @@ func (c *Client) ListSplunks(i *ListSplunksInput) ([]*Splunk, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/splunk", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "splunk") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -105,7 +104,7 @@ func (c *Client) CreateSplunk(i *CreateSplunkInput) (*Splunk, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/splunk", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "splunk") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -141,7 +140,7 @@ func (c *Client) GetSplunk(i *GetSplunkInput) (*Splunk, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/splunk/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "splunk", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -205,7 +204,7 @@ func (c *Client) UpdateSplunk(i *UpdateSplunkInput) (*Splunk, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/splunk/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "splunk", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -241,7 +240,7 @@ func (c *Client) DeleteSplunk(i *DeleteSplunkInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/splunk/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "splunk", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_sumologic.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_sumologic.go index f9c2386d5..cfab88217 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_sumologic.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_sumologic.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -40,7 +39,7 @@ func (c *Client) ListSumologics(i *ListSumologicsInput) ([]*Sumologic, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/sumologic", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "sumologic") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -85,7 +84,7 @@ func (c *Client) CreateSumologic(i *CreateSumologicInput) (*Sumologic, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/sumologic", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "sumologic") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -121,7 +120,7 @@ func (c *Client) GetSumologic(i *GetSumologicInput) (*Sumologic, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/sumologic/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "sumologic", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -172,7 +171,7 @@ func (c *Client) UpdateSumologic(i *UpdateSumologicInput) (*Sumologic, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/sumologic/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "sumologic", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -208,7 +207,7 @@ func (c *Client) DeleteSumologic(i *DeleteSumologicInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/sumologic/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "sumologic", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_syslog.go b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_syslog.go index 881925fe0..efd2bfa31 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/logging_syslog.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/logging_syslog.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -48,7 +47,7 @@ func (c *Client) ListSyslogs(i *ListSyslogsInput) ([]*Syslog, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/syslog", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "syslog") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -111,7 +110,7 @@ func (c *Client) CreateSyslog(i *CreateSyslogInput) (*Syslog, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/syslog", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "syslog") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -147,7 +146,7 @@ func (c *Client) GetSyslog(i *GetSyslogInput) (*Syslog, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/syslog/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "syslog", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -215,7 +214,7 @@ func (c *Client) UpdateSyslog(i *UpdateSyslogInput) (*Syslog, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/syslog/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "syslog", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -251,7 +250,7 @@ func (c *Client) DeleteSyslog(i *DeleteSyslogInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/logging/syslog/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "logging", "syslog", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/managed_logging.go b/vendor/github.com/fastly/go-fastly/v9/fastly/managed_logging.go index bc761a1a3..688595d94 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/managed_logging.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/managed_logging.go @@ -1,7 +1,6 @@ package fastly import ( - "fmt" "net/http" ) @@ -43,7 +42,7 @@ func (c *Client) CreateManagedLogging(i *CreateManagedLoggingInput) (*ManagedLog case ManagedLoggingUnset: return nil, ErrMissingKind case ManagedLoggingInstanceOutput: - path = fmt.Sprintf("/service/%s/log_stream/managed/instance_output", i.ServiceID) + path = ToSafeURL("service", i.ServiceID, "log_stream", "managed", "instance_output") default: return nil, ErrNotImplemented } @@ -88,7 +87,7 @@ func (c *Client) DeleteManagedLogging(i *DeleteManagedLoggingInput) error { case ManagedLoggingUnset: return ErrMissingKind case ManagedLoggingInstanceOutput: - path = fmt.Sprintf("/service/%s/log_stream/managed/instance_output", i.ServiceID) + path = ToSafeURL("service", i.ServiceID, "log_stream", "managed", "instance_output") default: return ErrNotImplemented } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/notifications.go b/vendor/github.com/fastly/go-fastly/v9/fastly/notifications.go index e897d1938..eae8c265b 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/notifications.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/notifications.go @@ -2,7 +2,6 @@ package fastly import ( "encoding/json" - "fmt" "net/http" "strconv" "time" @@ -126,7 +125,8 @@ func (c *Client) GetIntegration(i *GetIntegrationInput) (*Integration, error) { return nil, ErrMissingID } - path := fmt.Sprintf("/notifications/integrations/%s", i.ID) + path := ToSafeURL("notifications", "integrations", i.ID) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -161,7 +161,8 @@ func (c *Client) UpdateIntegration(i *UpdateIntegrationInput) error { return ErrMissingID } - path := fmt.Sprintf("/notifications/integrations/%s", i.ID) + path := ToSafeURL("notifications", "integrations", i.ID) + resp, err := c.PatchJSON(path, i, nil) if err != nil { return err @@ -187,7 +188,8 @@ func (c *Client) DeleteIntegration(i *DeleteIntegrationInput) error { return ErrMissingID } - path := fmt.Sprintf("/notifications/integrations/%s", i.ID) + path := ToSafeURL("notifications", "integrations", i.ID) + resp, err := c.Delete(path, nil) if err != nil { return err @@ -248,7 +250,8 @@ func (c *Client) GetWebhookSigningKey(i *GetWebhookSigningKeyInput) (*WebhookSig return nil, ErrMissingIntegrationID } - path := fmt.Sprintf("/notifications/integrations/%s/signingKey", i.IntegrationID) + path := ToSafeURL("notifications", "integrations", i.IntegrationID, "signingKey") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -274,7 +277,8 @@ func (c *Client) RotateWebhookSigningKey(i *RotateWebhookSigningKeyInput) (*Webh return nil, ErrMissingIntegrationID } - path := fmt.Sprintf("/notifications/integrations/%s/rotateSigningKey", i.IntegrationID) + path := ToSafeURL("notifications", "integrations", i.IntegrationID, "rotateSigningKey") + resp, err := c.Post(path, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/product_enablement.go b/vendor/github.com/fastly/go-fastly/v9/fastly/product_enablement.go index c8d6fc061..3fe1435a6 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/product_enablement.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/product_enablement.go @@ -1,8 +1,6 @@ package fastly -import ( - "fmt" -) +import "fmt" // ProductEnablement represents a response from the Fastly API. type ProductEnablement struct { @@ -68,7 +66,8 @@ func (c *Client) GetProduct(i *ProductEnablementInput) (*ProductEnablement, erro return nil, ErrMissingServiceID } - path := fmt.Sprintf("/enabled-products/%s/services/%s", i.ProductID, i.ServiceID) + path := ToSafeURL("enabled-products", fmt.Sprint(i.ProductID), "services", i.ServiceID) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -92,7 +91,8 @@ func (c *Client) EnableProduct(i *ProductEnablementInput) (*ProductEnablement, e return nil, ErrMissingServiceID } - path := fmt.Sprintf("/enabled-products/%s/services/%s", i.ProductID, i.ServiceID) + path := ToSafeURL("enabled-products", fmt.Sprint(i.ProductID), "services", i.ServiceID) + resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -115,7 +115,8 @@ func (c *Client) DisableProduct(i *ProductEnablementInput) error { return ErrMissingServiceID } - path := fmt.Sprintf("/enabled-products/%s/services/%s", i.ProductID, i.ServiceID) + path := ToSafeURL("enabled-products", fmt.Sprint(i.ProductID), "services", i.ServiceID) + _, err := c.Delete(path, nil) return err } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/purge.go b/vendor/github.com/fastly/go-fastly/v9/fastly/purge.go index 36ec838e9..4113e4848 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/purge.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/purge.go @@ -1,7 +1,6 @@ package fastly import ( - "fmt" "net/url" "strings" ) @@ -94,7 +93,7 @@ func (c *Client) PurgeKey(i *PurgeKeyInput) (*Purge, error) { return nil, ErrMissingKey } - path := fmt.Sprintf("/service/%s/purge/%s", i.ServiceID, i.Key) + path := ToSafeURL("service", i.ServiceID, "purge", i.Key) ro := new(RequestOptions) ro.Parallel = true @@ -139,7 +138,7 @@ func (c *Client) PurgeKeys(i *PurgeKeysInput) (map[string]string, error) { return nil, ErrMissingKeys } - path := fmt.Sprintf("/service/%s/purge", i.ServiceID) + path := ToSafeURL("service", i.ServiceID, "purge") ro := new(RequestOptions) ro.Parallel = true @@ -179,7 +178,8 @@ func (c *Client) PurgeAll(i *PurgeAllInput) (*Purge, error) { return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/purge_all", i.ServiceID) + path := ToSafeURL("service", i.ServiceID, "purge_all") + req, err := c.RawRequest("POST", path, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/resource.go b/vendor/github.com/fastly/go-fastly/v9/fastly/resource.go index 1de8d8414..4cc3bda62 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/resource.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/resource.go @@ -2,7 +2,7 @@ package fastly import ( "fmt" - "net/url" + "strconv" "time" ) @@ -47,7 +47,7 @@ func (c *Client) ListResources(i *ListResourcesInput) ([]*Resource, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/resource", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "resource") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -87,7 +87,7 @@ func (c *Client) CreateResource(i *CreateResourceInput) (*Resource, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/resource", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "resource") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -123,7 +123,7 @@ func (c *Client) GetResource(i *GetResourceInput) (*Resource, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/resource/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.ResourceID)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "resource", i.ResourceID) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -161,7 +161,7 @@ func (c *Client) UpdateResource(i *UpdateResourceInput) (*Resource, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/resource/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.ResourceID)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "resource", i.ResourceID) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -197,7 +197,7 @@ func (c *Client) DeleteResource(i *DeleteResourceInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/resource/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.ResourceID)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "resource", i.ResourceID) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/secret_store.go b/vendor/github.com/fastly/go-fastly/v9/fastly/secret_store.go index 0efacf2e3..ff440ad93 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/secret_store.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/secret_store.go @@ -44,8 +44,8 @@ func (c *Client) CreateSecretStore(i *CreateSecretStoreInput) (*SecretStore, err return nil, ErrMissingName } - p := "/resources/stores/secret" - resp, err := c.PostJSON(p, i, &RequestOptions{ + path := "/resources/stores/secret" + resp, err := c.PostJSON(path, i, &RequestOptions{ Parallel: true, }) if err != nil { @@ -84,7 +84,7 @@ type ListSecretStoresInput struct { // The returned next cursor, if non-blank, can be used as input to a subsequent // request for the next page of results. func (c *Client) ListSecretStores(i *ListSecretStoresInput) (*SecretStores, error) { - p := "/resources/stores/secret" + path := "/resources/stores/secret" params := make(map[string]string, 2) if i.Limit > 0 { @@ -97,7 +97,7 @@ func (c *Client) ListSecretStores(i *ListSecretStoresInput) (*SecretStores, erro params["name"] = i.Name } - resp, err := c.Get(p, &RequestOptions{ + resp, err := c.Get(path, &RequestOptions{ Params: params, Headers: map[string]string{ "Content-Type": "application/json", @@ -130,9 +130,9 @@ func (c *Client) GetSecretStore(i *GetSecretStoreInput) (*SecretStore, error) { return nil, ErrMissingStoreID } - p := "/resources/stores/secret/" + i.StoreID + path := ToSafeURL("resources", "stores", "secret", i.StoreID) - resp, err := c.Get(p, &RequestOptions{ + resp, err := c.Get(path, &RequestOptions{ Headers: map[string]string{ "Content-Type": "application/json", "Accept": "application/json", @@ -164,9 +164,9 @@ func (c *Client) DeleteSecretStore(i *DeleteSecretStoreInput) error { return ErrMissingStoreID } - p := "/resources/stores/secret/" + i.StoreID + path := ToSafeURL("resources", "stores", "secret", i.StoreID) - resp, err := c.Delete(p, &RequestOptions{ + resp, err := c.Delete(path, &RequestOptions{ Headers: map[string]string{ "Content-Type": "application/json", "Accept": "application/json", @@ -224,7 +224,7 @@ func (c *Client) CreateSecret(i *CreateSecretInput) (*Secret, error) { return nil, ErrMissingSecret } - p := "/resources/stores/secret/" + i.StoreID + "/secrets" + path := ToSafeURL("resources", "stores", "secret", i.StoreID, "secrets") var body bytes.Buffer err := json.NewEncoder(&body).Encode(struct { @@ -251,7 +251,7 @@ func (c *Client) CreateSecret(i *CreateSecretInput) (*Secret, error) { return nil, ErrInvalidMethod } - resp, err := c.Request(method, p, &RequestOptions{ + resp, err := c.Request(method, path, &RequestOptions{ Headers: map[string]string{ "Content-Type": "application/json", "Accept": "application/json", @@ -299,7 +299,7 @@ func (c *Client) ListSecrets(i *ListSecretsInput) (*Secrets, error) { return nil, ErrMissingStoreID } - p := "/resources/stores/secret/" + i.StoreID + "/secrets" + path := ToSafeURL("resources", "stores", "secret", i.StoreID, "secrets") params := make(map[string]string, 2) if i.Limit > 0 { @@ -309,7 +309,7 @@ func (c *Client) ListSecrets(i *ListSecretsInput) (*Secrets, error) { params["cursor"] = i.Cursor } - resp, err := c.Get(p, &RequestOptions{ + resp, err := c.Get(path, &RequestOptions{ Params: params, Headers: map[string]string{ "Content-Type": "application/json", @@ -347,9 +347,9 @@ func (c *Client) GetSecret(i *GetSecretInput) (*Secret, error) { return nil, ErrMissingName } - p := "/resources/stores/secret/" + i.StoreID + "/secrets/" + i.Name + path := ToSafeURL("resources", "stores", "secret", i.StoreID, "secrets", i.Name) - resp, err := c.Get(p, &RequestOptions{ + resp, err := c.Get(path, &RequestOptions{ Headers: map[string]string{ "Content-Type": "application/json", "Accept": "application/json", @@ -386,9 +386,9 @@ func (c *Client) DeleteSecret(i *DeleteSecretInput) error { return ErrMissingName } - p := "/resources/stores/secret/" + i.StoreID + "/secrets/" + i.Name + path := ToSafeURL("resources", "stores", "secret", i.StoreID, "secrets", i.Name) - resp, err := c.Delete(p, &RequestOptions{ + resp, err := c.Delete(path, &RequestOptions{ Headers: map[string]string{ "Content-Type": "application/json", "Accept": "application/json", @@ -439,9 +439,9 @@ func (ck *ClientKey) Encrypt(plaintext []byte) ([]byte, error) { // CreateClientKey creates a new time-limited client key for locally // encrypting secrets before uploading them to the Fastly API. func (c *Client) CreateClientKey() (*ClientKey, error) { - p := "/resources/stores/secret/client-key" + path := "/resources/stores/secret/client-key" - resp, err := c.Post(p, &RequestOptions{ + resp, err := c.Post(path, &RequestOptions{ Headers: map[string]string{ "Content-Type": "application/json", "Accept": "application/json", @@ -465,9 +465,9 @@ func (c *Client) CreateClientKey() (*ClientKey, error) { // general the signing key changes very rarely, and it's recommended to // ship the signing key out-of-band from the API. func (c *Client) GetSigningKey() (ed25519.PublicKey, error) { - p := "/resources/stores/secret/signing-key" + path := "/resources/stores/secret/signing-key" - resp, err := c.Get(p, &RequestOptions{ + resp, err := c.Get(path, &RequestOptions{ Headers: map[string]string{ "Content-Type": "application/json", "Accept": "application/json", diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/service_authorization.go b/vendor/github.com/fastly/go-fastly/v9/fastly/service_authorization.go index cebe9a978..5ccf48351 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/service_authorization.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/service_authorization.go @@ -116,7 +116,8 @@ func (c *Client) GetServiceAuthorization(i *GetServiceAuthorizationInput) (*Serv return nil, ErrMissingID } - path := fmt.Sprintf("/service-authorizations/%s", i.ID) + path := ToSafeURL("service-authorizations", i.ID) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -188,7 +189,8 @@ func (c *Client) UpdateServiceAuthorization(i *UpdateServiceAuthorizationInput) return nil, ErrMissingPermission } - path := fmt.Sprintf("/service-authorizations/%s", i.ID) + path := ToSafeURL("service-authorizations", i.ID) + resp, err := c.PatchJSONAPI(path, i, nil) if err != nil { return nil, err @@ -215,7 +217,8 @@ func (c *Client) DeleteServiceAuthorization(i *DeleteServiceAuthorizationInput) return ErrMissingID } - path := fmt.Sprintf("/service-authorizations/%s", i.ID) + path := ToSafeURL("service-authorizations", i.ID) + _, err := c.Delete(path, nil) return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/service_details.go b/vendor/github.com/fastly/go-fastly/v9/fastly/service_details.go index eb44904c1..a0490e904 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/service_details.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/service_details.go @@ -7,31 +7,33 @@ import ( // Service represents a server response from the Fastly API. type Service struct { - ActiveVersion *int `mapstructure:"version"` - Comment *string `mapstructure:"comment"` - CreatedAt *time.Time `mapstructure:"created_at"` - CustomerID *string `mapstructure:"customer_id"` - DeletedAt *time.Time `mapstructure:"deleted_at"` - ServiceID *string `mapstructure:"id"` - Name *string `mapstructure:"name"` - Type *string `mapstructure:"type"` - UpdatedAt *time.Time `mapstructure:"updated_at"` - Versions []*Version `mapstructure:"versions"` + ActiveVersion *int `mapstructure:"version"` + Comment *string `mapstructure:"comment"` + CreatedAt *time.Time `mapstructure:"created_at"` + CustomerID *string `mapstructure:"customer_id"` + DeletedAt *time.Time `mapstructure:"deleted_at"` + ServiceID *string `mapstructure:"id"` + Name *string `mapstructure:"name"` + Type *string `mapstructure:"type"` + UpdatedAt *time.Time `mapstructure:"updated_at"` + Versions []*Version `mapstructure:"versions"` + Environments []*Environment `mapstructure:"environments"` } // ServiceDetail represents a server response from the Fastly API. type ServiceDetail struct { - ActiveVersion *Version `mapstructure:"active_version"` - Comment *string `mapstructure:"comment"` - CreatedAt *time.Time `mapstructure:"created_at"` - CustomerID *string `mapstructure:"customer_id"` - DeletedAt *time.Time `mapstructure:"deleted_at"` - ServiceID *string `mapstructure:"id"` - Name *string `mapstructure:"name"` - Type *string `mapstructure:"type"` - UpdatedAt *time.Time `mapstructure:"updated_at"` - Version *Version `mapstructure:"version"` - Versions []*Version `mapstructure:"versions"` + ActiveVersion *Version `mapstructure:"active_version"` + Comment *string `mapstructure:"comment"` + CreatedAt *time.Time `mapstructure:"created_at"` + CustomerID *string `mapstructure:"customer_id"` + DeletedAt *time.Time `mapstructure:"deleted_at"` + ServiceID *string `mapstructure:"id"` + Name *string `mapstructure:"name"` + Type *string `mapstructure:"type"` + UpdatedAt *time.Time `mapstructure:"updated_at"` + Version *Version `mapstructure:"version"` + Versions []*Version `mapstructure:"versions"` + Environments []*Environment `mapstructure:"environments"` } // ServiceDomain represents a server response from the Fastly API. @@ -143,7 +145,8 @@ func (c *Client) GetService(i *GetServiceInput) (*Service, error) { return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s", i.ServiceID) + path := ToSafeURL("service", i.ServiceID) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -178,7 +181,8 @@ func (c *Client) GetServiceDetails(i *GetServiceInput) (*ServiceDetail, error) { return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/details", i.ServiceID) + path := ToSafeURL("service", i.ServiceID, "details") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -209,7 +213,8 @@ func (c *Client) UpdateService(i *UpdateServiceInput) (*Service, error) { return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s", i.ServiceID) + path := ToSafeURL("service", i.ServiceID) + resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -235,7 +240,8 @@ func (c *Client) DeleteService(i *DeleteServiceInput) error { return ErrMissingServiceID } - path := fmt.Sprintf("/service/%s", i.ServiceID) + path := ToSafeURL("service", i.ServiceID) + resp, err := c.Delete(path, nil) if err != nil { return err @@ -297,7 +303,8 @@ func (c *Client) ListServiceDomains(i *ListServiceDomainInput) (ServiceDomainsLi return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/domain", i.ServiceID) + path := ToSafeURL("service", i.ServiceID, "domain") + resp, err := c.Get(path, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/service_version.go b/vendor/github.com/fastly/go-fastly/v9/fastly/service_version.go index dd92b053c..817668de5 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/service_version.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/service_version.go @@ -1,23 +1,31 @@ package fastly import ( - "fmt" + "strconv" "time" ) // Version represents a distinct configuration version. type Version struct { - Active *bool `mapstructure:"active"` - Comment *string `mapstructure:"comment"` - CreatedAt *time.Time `mapstructure:"created_at"` - DeletedAt *time.Time `mapstructure:"deleted_at"` - Deployed *bool `mapstructure:"deployed"` - Locked *bool `mapstructure:"locked"` - Number *int `mapstructure:"number"` - ServiceID *string `mapstructure:"service_id"` - Staging *bool `mapstructure:"staging"` - Testing *bool `mapstructure:"testing"` - UpdatedAt *time.Time `mapstructure:"updated_at"` + Active *bool `mapstructure:"active"` + Comment *string `mapstructure:"comment"` + CreatedAt *time.Time `mapstructure:"created_at"` + DeletedAt *time.Time `mapstructure:"deleted_at"` + Deployed *bool `mapstructure:"deployed"` + Locked *bool `mapstructure:"locked"` + Number *int `mapstructure:"number"` + ServiceID *string `mapstructure:"service_id"` + Staging *bool `mapstructure:"staging"` + Testing *bool `mapstructure:"testing"` + UpdatedAt *time.Time `mapstructure:"updated_at"` + Environments []*Environment `mapstructure:"environments"` +} + +// Environment represents a distinct deployment environment. +type Environment struct { + ServiceVersion *int64 `mapstructure:"active_version"` + Name *string `mapstructure:"name"` + ServiceID *string `mapstructure:"service_id"` } // ListVersionsInput is the input to the ListVersions function. @@ -32,7 +40,8 @@ func (c *Client) ListVersions(i *ListVersionsInput) ([]*Version, error) { return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/version", i.ServiceID) + path := ToSafeURL("service", i.ServiceID, "version") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -90,7 +99,8 @@ func (c *Client) CreateVersion(i *CreateVersionInput) (*Version, error) { return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/version", i.ServiceID) + path := ToSafeURL("service", i.ServiceID, "version") + resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -121,7 +131,7 @@ func (c *Client) GetVersion(i *GetVersionInput) (*Version, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion)) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -154,7 +164,7 @@ func (c *Client) UpdateVersion(i *UpdateVersionInput) (*Version, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion)) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -174,6 +184,8 @@ type ActivateVersionInput struct { ServiceID string // ServiceVersion is the specific configuration version (required). ServiceVersion int + // Environment is the Fastly environment to activate this version to (optional). + Environment string } // ActivateVersion activates the given version. @@ -185,7 +197,13 @@ func (c *Client) ActivateVersion(i *ActivateVersionInput) (*Version, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/activate", i.ServiceID, i.ServiceVersion) + components := []string{"service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "activate"} + if i.Environment != "" { + components = append(components, i.Environment) + } + + path := ToSafeURL(components...) + resp, err := c.Put(path, nil) if err != nil { return nil, err @@ -205,6 +223,8 @@ type DeactivateVersionInput struct { ServiceID string // ServiceVersion is the specific configuration version (required). ServiceVersion int + // Environment is the Fastly environment to deactivate this version from (optional). + Environment string } // DeactivateVersion deactivates the given version. @@ -216,7 +236,13 @@ func (c *Client) DeactivateVersion(i *DeactivateVersionInput) (*Version, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/deactivate", i.ServiceID, i.ServiceVersion) + components := []string{"service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "deactivate"} + if i.Environment != "" { + components = append(components, i.Environment) + } + + path := ToSafeURL(components...) + resp, err := c.Put(path, nil) if err != nil { return nil, err @@ -250,7 +276,7 @@ func (c *Client) CloneVersion(i *CloneVersionInput) (*Version, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/clone", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "clone") resp, err := c.Put(path, nil) if err != nil { return nil, err @@ -283,7 +309,7 @@ func (c *Client) ValidateVersion(i *ValidateVersionInput) (bool, string, error) return false, msg, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/validate", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "validate") resp, err := c.Get(path, nil) if err != nil { return false, msg, err @@ -316,7 +342,7 @@ func (c *Client) LockVersion(i *LockVersionInput) (*Version, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/lock", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "lock") resp, err := c.Put(path, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/stats_domain_inspector.go b/vendor/github.com/fastly/go-fastly/v9/fastly/stats_domain_inspector.go index b12be4de3..d9478edfe 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/stats_domain_inspector.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/stats_domain_inspector.go @@ -149,7 +149,7 @@ func (c *Client) GetDomainMetricsForServiceJSON(i *GetDomainMetricsInput, dst an return ErrMissingServiceID } - p := "/metrics/domains/services/" + i.ServiceID + path := ToSafeURL("metrics", "domains", "services", i.ServiceID) ro := &RequestOptions{ Params: map[string]string{ @@ -176,7 +176,7 @@ func (c *Client) GetDomainMetricsForServiceJSON(i *GetDomainMetricsInput, dst an ro.Params["start"] = strconv.FormatInt(i.Start.Unix(), 10) } - resp, err := c.Get(p, ro) + resp, err := c.Get(path, ro) if err != nil { return err } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/stats_historical.go b/vendor/github.com/fastly/go-fastly/v9/fastly/stats_historical.go index 443e387e4..092179a6b 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/stats_historical.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/stats_historical.go @@ -2,7 +2,6 @@ package fastly import ( "encoding/json" - "fmt" ) // StatsResponse is a response from the service stats API endpoint. @@ -147,14 +146,19 @@ func (c *Client) GetStatsField(i *GetStatsInput) (*StatsFieldResponse, error) { // GetStatsJSON fetches stats and decodes the response directly to the JSON struct dst. func (c *Client) GetStatsJSON(i *GetStatsInput, dst any) error { - p := "/stats" + components := make([]string, 1, 5) + + components[0] = "stats" + if i.Service != nil { - p = fmt.Sprintf("%s/service/%s", p, *i.Service) + components = append(components, "service", *i.Service) } if i.Field != nil { - p = fmt.Sprintf("%s/field/%s", p, *i.Field) + components = append(components, "field", *i.Field) } + path := ToSafeURL(components...) + ro := &RequestOptions{ Params: map[string]string{}, } @@ -171,7 +175,7 @@ func (c *Client) GetStatsJSON(i *GetStatsInput, dst any) error { ro.Params["to"] = *i.To } - resp, err := c.Get(p, ro) + resp, err := c.Get(path, ro) if err != nil { return err } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/stats_origin_inspector.go b/vendor/github.com/fastly/go-fastly/v9/fastly/stats_origin_inspector.go index a11e0afce..f724c8876 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/stats_origin_inspector.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/stats_origin_inspector.go @@ -123,7 +123,7 @@ func (c *Client) GetOriginMetricsForServiceJSON(i *GetOriginMetricsInput, dst an return ErrMissingServiceID } - p := "/metrics/origins/services/" + i.ServiceID + path := ToSafeURL("metrics", "origins", "services", i.ServiceID) ro := &RequestOptions{ Params: map[string]string{ @@ -147,7 +147,7 @@ func (c *Client) GetOriginMetricsForServiceJSON(i *GetOriginMetricsInput, dst an ro.Params["start"] = strconv.FormatInt(i.Start.Unix(), 10) } - resp, err := c.Get(p, ro) + resp, err := c.Get(path, ro) if err != nil { return err } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/stats_realtime.go b/vendor/github.com/fastly/go-fastly/v9/fastly/stats_realtime.go index 4e1d0e599..0b58859f5 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/stats_realtime.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/stats_realtime.go @@ -2,7 +2,7 @@ package fastly import ( "encoding/json" - "fmt" + "strconv" ) // RealtimeStatsResponse is a response from Fastly's real-time analytics @@ -60,12 +60,14 @@ func (c *RTSClient) GetRealtimeStatsJSON(i *GetRealtimeStatsInput, dst any) erro return ErrMissingServiceID } - path := fmt.Sprintf("/v1/channel/%s/ts/%d", i.ServiceID, i.Timestamp) + components := []string{"v1", "channel", i.ServiceID, "ts", strconv.FormatUint(i.Timestamp, 10)} if i.Limit != nil { - path = fmt.Sprintf("%s/limit/%d", path, *i.Limit) + components = append(components, "limit", strconv.FormatUint(uint64(*i.Limit), 10)) } + path := ToSafeURL(components...) + resp, err := c.client.Get(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_custom_activation.go b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_custom_activation.go index fcad99adb..e94222a0f 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_custom_activation.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_custom_activation.go @@ -67,7 +67,7 @@ func (i *ListTLSActivationsInput) formatFilters() map[string]string { // ListTLSActivations retrieves all resources. func (c *Client) ListTLSActivations(i *ListTLSActivationsInput) ([]*TLSActivation, error) { - p := "/tls/activations" + path := "/tls/activations" filters := &RequestOptions{ Params: i.formatFilters(), Headers: map[string]string{ @@ -75,7 +75,7 @@ func (c *Client) ListTLSActivations(i *ListTLSActivationsInput) ([]*TLSActivatio }, } - resp, err := c.Get(p, filters) + resp, err := c.Get(path, filters) if err != nil { return nil, err } @@ -112,7 +112,7 @@ func (c *Client) GetTLSActivation(i *GetTLSActivationInput) (*TLSActivation, err return nil, ErrMissingID } - p := fmt.Sprintf("/tls/activations/%s", i.ID) + path := ToSafeURL("tls", "activations", i.ID) ro := &RequestOptions{ Headers: map[string]string{ @@ -124,7 +124,7 @@ func (c *Client) GetTLSActivation(i *GetTLSActivationInput) (*TLSActivation, err ro.Params = map[string]string{"include": *i.Include} } - resp, err := c.Get(p, ro) + resp, err := c.Get(path, ro) if err != nil { return nil, err } @@ -159,9 +159,9 @@ func (c *Client) CreateTLSActivation(i *CreateTLSActivationInput) (*TLSActivatio return nil, ErrMissingTLSDomain } - p := "/tls/activations" + path := "/tls/activations" - resp, err := c.PostJSONAPI(p, i, nil) + resp, err := c.PostJSONAPI(path, i, nil) if err != nil { return nil, err } @@ -194,7 +194,8 @@ func (c *Client) UpdateTLSActivation(i *UpdateTLSActivationInput) (*TLSActivatio return nil, ErrMissingCertificateMTLS } - path := fmt.Sprintf("/tls/activations/%s", i.ID) + path := ToSafeURL("tls", "activations", i.ID) + resp, err := c.PatchJSONAPI(path, i, nil) if err != nil { return nil, err @@ -220,7 +221,8 @@ func (c *Client) DeleteTLSActivation(i *DeleteTLSActivationInput) error { return ErrMissingID } - path := fmt.Sprintf("/tls/activations/%s", i.ID) + path := ToSafeURL("tls", "activations", i.ID) + _, err := c.Delete(path, nil) return err } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_custom_certificate.go b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_custom_certificate.go index a280b864c..67f8e05cd 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_custom_certificate.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_custom_certificate.go @@ -78,7 +78,7 @@ func (i *ListCustomTLSCertificatesInput) formatFilters() map[string]string { // ListCustomTLSCertificates retrieves all resources. func (c *Client) ListCustomTLSCertificates(i *ListCustomTLSCertificatesInput) ([]*CustomTLSCertificate, error) { - p := "/tls/certificates" + path := "/tls/certificates" filters := &RequestOptions{ Params: i.formatFilters(), Headers: map[string]string{ @@ -86,7 +86,7 @@ func (c *Client) ListCustomTLSCertificates(i *ListCustomTLSCertificatesInput) ([ }, } - resp, err := c.Get(p, filters) + resp, err := c.Get(path, filters) if err != nil { return nil, err } @@ -121,9 +121,9 @@ func (c *Client) GetCustomTLSCertificate(i *GetCustomTLSCertificateInput) (*Cust return nil, ErrMissingID } - p := fmt.Sprintf("/tls/certificates/%s", i.ID) + path := ToSafeURL("tls", "certificates", i.ID) - resp, err := c.Get(p, nil) + resp, err := c.Get(path, nil) if err != nil { return nil, err } @@ -153,9 +153,9 @@ func (c *Client) CreateCustomTLSCertificate(i *CreateCustomTLSCertificateInput) return nil, ErrMissingCertBlob } - p := "/tls/certificates" + path := "/tls/certificates" - resp, err := c.PostJSONAPI(p, i, nil) + resp, err := c.PostJSONAPI(path, i, nil) if err != nil { return nil, err } @@ -193,7 +193,8 @@ func (c *Client) UpdateCustomTLSCertificate(i *UpdateCustomTLSCertificateInput) return nil, ErrMissingCertBlob } - path := fmt.Sprintf("/tls/certificates/%s", i.ID) + path := ToSafeURL("tls", "certificates", i.ID) + resp, err := c.PatchJSONAPI(path, i, nil) if err != nil { return nil, err @@ -219,7 +220,8 @@ func (c *Client) DeleteCustomTLSCertificate(i *DeleteCustomTLSCertificateInput) return ErrMissingID } - path := fmt.Sprintf("/tls/certificates/%s", i.ID) + path := ToSafeURL("tls", "certificates", i.ID) + _, err := c.Delete(path, nil) return err } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_custom_configuration.go b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_custom_configuration.go index f47405a90..0b310ba82 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_custom_configuration.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_custom_configuration.go @@ -71,7 +71,7 @@ func (i *ListCustomTLSConfigurationsInput) formatFilters() map[string]string { // ListCustomTLSConfigurations retrieves all resources. func (c *Client) ListCustomTLSConfigurations(i *ListCustomTLSConfigurationsInput) ([]*CustomTLSConfiguration, error) { - p := "/tls/configurations" + path := "/tls/configurations" ro := &RequestOptions{ Params: i.formatFilters(), Headers: map[string]string{ @@ -79,7 +79,7 @@ func (c *Client) ListCustomTLSConfigurations(i *ListCustomTLSConfigurationsInput }, } - resp, err := c.Get(p, ro) + resp, err := c.Get(path, ro) if err != nil { return nil, err } @@ -116,7 +116,7 @@ func (c *Client) GetCustomTLSConfiguration(i *GetCustomTLSConfigurationInput) (* return nil, ErrMissingID } - p := fmt.Sprintf("/tls/configurations/%s", i.ID) + path := ToSafeURL("tls", "configurations", i.ID) ro := &RequestOptions{ Headers: map[string]string{ @@ -128,7 +128,7 @@ func (c *Client) GetCustomTLSConfiguration(i *GetCustomTLSConfigurationInput) (* ro.Params = map[string]string{"include": i.Include} } - resp, err := c.Get(p, ro) + resp, err := c.Get(path, ro) if err != nil { return nil, err } @@ -160,7 +160,8 @@ func (c *Client) UpdateCustomTLSConfiguration(i *UpdateCustomTLSConfigurationInp return nil, ErrMissingName } - path := fmt.Sprintf("/tls/configurations/%s", i.ID) + path := ToSafeURL("tls", "configurations", i.ID) + resp, err := c.PatchJSONAPI(path, i, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_mutual_authentication.go b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_mutual_authentication.go index aac4272bc..08476794a 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_mutual_authentication.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_mutual_authentication.go @@ -47,7 +47,7 @@ func (i *ListTLSMutualAuthenticationsInput) formatFilters() map[string]string { // ListTLSMutualAuthentication retrieves all resources. func (c *Client) ListTLSMutualAuthentication(i *ListTLSMutualAuthenticationsInput) ([]*TLSMutualAuthentication, error) { - p := "/tls/mutual_authentications" + path := "/tls/mutual_authentications" filters := &RequestOptions{ Params: i.formatFilters(), Headers: map[string]string{ @@ -55,7 +55,7 @@ func (c *Client) ListTLSMutualAuthentication(i *ListTLSMutualAuthenticationsInpu }, } - resp, err := c.Get(p, filters) + resp, err := c.Get(path, filters) if err != nil { return nil, err } @@ -104,9 +104,9 @@ func (c *Client) GetTLSMutualAuthentication(i *GetTLSMutualAuthenticationInput) } } - p := fmt.Sprintf("/tls/mutual_authentications/%s", i.ID) + path := ToSafeURL("tls", "mutual_authentications", i.ID) - resp, err := c.Get(p, ro) + resp, err := c.Get(path, ro) if err != nil { return nil, err } @@ -138,9 +138,9 @@ func (c *Client) CreateTLSMutualAuthentication(i *CreateTLSMutualAuthenticationI return nil, ErrMissingCertBundle } - p := "/tls/mutual_authentications" + path := "/tls/mutual_authentications" - resp, err := c.PostJSONAPI(p, i, nil) + resp, err := c.PostJSONAPI(path, i, nil) if err != nil { return nil, err } @@ -175,7 +175,8 @@ func (c *Client) UpdateTLSMutualAuthentication(i *UpdateTLSMutualAuthenticationI return nil, ErrMissingID } - path := fmt.Sprintf("/tls/mutual_authentications/%s", i.ID) + path := ToSafeURL("tls", "mutual_authentications", i.ID) + resp, err := c.PatchJSONAPI(path, i, nil) if err != nil { return nil, err @@ -201,7 +202,8 @@ func (c *Client) DeleteTLSMutualAuthentication(i *DeleteTLSMutualAuthenticationI return ErrMissingID } - path := fmt.Sprintf("/tls/mutual_authentications/%s", i.ID) + path := ToSafeURL("tls", "mutual_authentications", i.ID) + _, err := c.Delete(path, nil) return err } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_platform.go b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_platform.go index 50b88a2ed..e4af2ae20 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_platform.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_platform.go @@ -81,7 +81,7 @@ func (i *ListBulkCertificatesInput) formatFilters() map[string]string { // ListBulkCertificates retrieves all resources. func (c *Client) ListBulkCertificates(i *ListBulkCertificatesInput) ([]*BulkCertificate, error) { - p := "/tls/bulk/certificates" + path := "/tls/bulk/certificates" filters := &RequestOptions{ Params: i.formatFilters(), Headers: map[string]string{ @@ -89,7 +89,7 @@ func (c *Client) ListBulkCertificates(i *ListBulkCertificatesInput) ([]*BulkCert }, } - resp, err := c.Get(p, filters) + resp, err := c.Get(path, filters) if err != nil { return nil, err } @@ -124,9 +124,9 @@ func (c *Client) GetBulkCertificate(i *GetBulkCertificateInput) (*BulkCertificat return nil, ErrMissingID } - p := fmt.Sprintf("/tls/bulk/certificates/%s", i.ID) + path := ToSafeURL("tls", "bulk", "certificates", i.ID) - resp, err := c.Get(p, nil) + resp, err := c.Get(path, nil) if err != nil { return nil, err } @@ -161,9 +161,9 @@ func (c *Client) CreateBulkCertificate(i *CreateBulkCertificateInput) (*BulkCert return nil, ErrMissingIntermediatesBlob } - p := "/tls/bulk/certificates" + path := "/tls/bulk/certificates" - resp, err := c.PostJSONAPI(p, i, nil) + resp, err := c.PostJSONAPI(path, i, nil) if err != nil { return nil, err } @@ -207,7 +207,8 @@ func (c *Client) UpdateBulkCertificate(i *UpdateBulkCertificateInput) (*BulkCert return nil, ErrMissingIntermediatesBlob } - path := fmt.Sprintf("/tls/bulk/certificates/%s", i.ID) + path := ToSafeURL("tls", "bulk", "certificates", i.ID) + resp, err := c.PatchJSONAPI(path, i, nil) if err != nil { return nil, err @@ -233,7 +234,8 @@ func (c *Client) DeleteBulkCertificate(i *DeleteBulkCertificateInput) error { return ErrMissingID } - path := fmt.Sprintf("/tls/bulk/certificates/%s", i.ID) + path := ToSafeURL("tls", "bulk", "certificates", i.ID) + _, err := c.Delete(path, nil) return err } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_private_keys.go b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_private_keys.go index 06ecf3f97..2fcee28a2 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_private_keys.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_private_keys.go @@ -65,7 +65,7 @@ func (i *ListPrivateKeysInput) formatFilters() map[string]string { // ListPrivateKeys retrieves all resources. func (c *Client) ListPrivateKeys(i *ListPrivateKeysInput) ([]*PrivateKey, error) { - p := "/tls/private_keys" + path := "/tls/private_keys" filters := &RequestOptions{ Params: i.formatFilters(), Headers: map[string]string{ @@ -73,7 +73,7 @@ func (c *Client) ListPrivateKeys(i *ListPrivateKeysInput) ([]*PrivateKey, error) }, } - resp, err := c.Get(p, filters) + resp, err := c.Get(path, filters) if err != nil { return nil, err } @@ -102,9 +102,9 @@ func (c *Client) GetPrivateKey(i *GetPrivateKeyInput) (*PrivateKey, error) { return nil, ErrMissingID } - p := fmt.Sprintf("/tls/private_keys/%s", i.ID) + path := ToSafeURL("tls", "private_keys", i.ID) - resp, err := c.Get(p, nil) + resp, err := c.Get(path, nil) if err != nil { return nil, err } @@ -128,7 +128,7 @@ type CreatePrivateKeyInput struct { // CreatePrivateKey creates a new resource. func (c *Client) CreatePrivateKey(i *CreatePrivateKeyInput) (*PrivateKey, error) { - p := "/tls/private_keys" + path := "/tls/private_keys" if i.Key == "" { return nil, ErrMissingKey @@ -138,7 +138,7 @@ func (c *Client) CreatePrivateKey(i *CreatePrivateKeyInput) (*PrivateKey, error) return nil, ErrMissingName } - resp, err := c.PostJSONAPI(p, i, nil) + resp, err := c.PostJSONAPI(path, i, nil) if err != nil { return nil, err } @@ -164,7 +164,8 @@ func (c *Client) DeletePrivateKey(i *DeletePrivateKeyInput) error { return ErrMissingID } - path := fmt.Sprintf("/tls/private_keys/%s", i.ID) + path := ToSafeURL("tls", "private_keys", i.ID) + _, err := c.Delete(path, nil) return err } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_subscription.go b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_subscription.go index deecb2c42..0e8f358aa 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/tls_subscription.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/tls_subscription.go @@ -221,7 +221,7 @@ func (c *Client) GetTLSSubscription(i *GetTLSSubscriptionInput) (*TLSSubscriptio return nil, ErrMissingID } - path := fmt.Sprintf("/tls/subscriptions/%s", i.ID) + path := ToSafeURL("tls", "subscriptions", i.ID) requestOptions := &RequestOptions{ Headers: map[string]string{ @@ -278,7 +278,8 @@ func (c *Client) UpdateTLSSubscription(i *UpdateTLSSubscriptionInput) (*TLSSubsc } } - path := fmt.Sprintf("/tls/subscriptions/%s", i.ID) + path := ToSafeURL("tls", "subscriptions", i.ID) + resp, err := c.PatchJSONAPI(path, i, &ro) if err != nil { return nil, err @@ -316,7 +317,8 @@ func (c *Client) DeleteTLSSubscription(i *DeleteTLSSubscriptionInput) error { } } - path := fmt.Sprintf("/tls/subscriptions/%s", i.ID) + path := ToSafeURL("tls", "subscriptions", i.ID) + _, err := c.Delete(path, &ro) return err } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/token.go b/vendor/github.com/fastly/go-fastly/v9/fastly/token.go index 9d41feece..d6dec3a7f 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/token.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/token.go @@ -1,7 +1,6 @@ package fastly import ( - "fmt" "net/http" "time" ) @@ -67,7 +66,8 @@ func (c *Client) ListCustomerTokens(i *ListCustomerTokensInput) ([]*Token, error return nil, ErrMissingCustomerID } - path := fmt.Sprintf("/customer/%s/tokens", i.CustomerID) + path := ToSafeURL("customer", i.CustomerID, "tokens") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -148,7 +148,8 @@ func (c *Client) DeleteToken(i *DeleteTokenInput) error { return ErrMissingTokenID } - path := fmt.Sprintf("/tokens/%s", i.TokenID) + path := ToSafeURL("tokens", i.TokenID) + resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/user.go b/vendor/github.com/fastly/go-fastly/v9/fastly/user.go index 24c6a689f..3355d172c 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/user.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/user.go @@ -1,8 +1,6 @@ package fastly import ( - "fmt" - "net/url" "time" ) @@ -37,7 +35,8 @@ func (c *Client) ListCustomerUsers(i *ListCustomerUsersInput) ([]*User, error) { return nil, ErrMissingCustomerID } - path := fmt.Sprintf("/customer/%s/users", i.CustomerID) + path := ToSafeURL("customer", i.CustomerID, "users") + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -81,7 +80,8 @@ func (c *Client) GetUser(i *GetUserInput) (*User, error) { return nil, ErrMissingUserID } - path := fmt.Sprintf("/user/%s", i.UserID) + path := ToSafeURL("user", i.UserID) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -137,7 +137,8 @@ func (c *Client) UpdateUser(i *UpdateUserInput) (*User, error) { return nil, ErrMissingUserID } - path := fmt.Sprintf("/user/%s", i.UserID) + path := ToSafeURL("user", i.UserID) + resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -163,7 +164,8 @@ func (c *Client) DeleteUser(i *DeleteUserInput) error { return ErrMissingUserID } - path := fmt.Sprintf("/user/%s", i.UserID) + path := ToSafeURL("user", i.UserID) + resp, err := c.Delete(path, nil) if err != nil { return err @@ -192,7 +194,8 @@ func (c *Client) ResetUserPassword(i *ResetUserPasswordInput) error { return ErrMissingLogin } - path := fmt.Sprintf("/user/%s/password/request_reset", url.PathEscape(i.Login)) + path := ToSafeURL("user", i.Login, "password", "request_reset") + resp, err := c.Post(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_cache_setting.go b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_cache_setting.go index a7dd4bbde..27ac409d3 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_cache_setting.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_cache_setting.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -51,7 +50,7 @@ func (c *Client) ListCacheSettings(i *ListCacheSettingsInput) ([]*CacheSetting, return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/cache_settings", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "cache_settings") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -92,7 +91,7 @@ func (c *Client) CreateCacheSetting(i *CreateCacheSettingInput) (*CacheSetting, return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/cache_settings", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "cache_settings") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -128,7 +127,7 @@ func (c *Client) GetCacheSetting(i *GetCacheSettingInput) (*CacheSetting, error) return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/cache_settings/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "cache_settings", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -174,7 +173,7 @@ func (c *Client) UpdateCacheSetting(i *UpdateCacheSettingInput) (*CacheSetting, return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/cache_settings/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "cache_settings", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -210,7 +209,7 @@ func (c *Client) DeleteCacheSetting(i *DeleteCacheSettingInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/cache_settings/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "cache_settings", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_condition.go b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_condition.go index 003ae3e96..307060b28 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_condition.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_condition.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -37,7 +36,7 @@ func (c *Client) ListConditions(i *ListConditionsInput) ([]*Condition, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/condition", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "condition") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -76,7 +75,7 @@ func (c *Client) CreateCondition(i *CreateConditionInput) (*Condition, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/condition", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "condition") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -112,7 +111,7 @@ func (c *Client) GetCondition(i *GetConditionInput) (*Condition, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/condition/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "condition", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -156,7 +155,7 @@ func (c *Client) UpdateCondition(i *UpdateConditionInput) (*Condition, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/condition/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "condition", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -192,7 +191,7 @@ func (c *Client) DeleteCondition(i *DeleteConditionInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/condition/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "condition", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_custom.go b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_custom.go index a65d0b103..8fd6f612a 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_custom.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_custom.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -35,7 +34,7 @@ func (c *Client) ListVCLs(i *ListVCLsInput) ([]*VCL, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/vcl", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "vcl") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -71,7 +70,7 @@ func (c *Client) GetVCL(i *GetVCLInput) (*VCL, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/vcl/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "vcl", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -102,7 +101,7 @@ func (c *Client) GetGeneratedVCL(i *GetGeneratedVCLInput) (*VCL, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/generated_vcl", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "generated_vcl") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -139,7 +138,7 @@ func (c *Client) CreateVCL(i *CreateVCLInput) (*VCL, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/vcl", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "vcl") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -179,7 +178,7 @@ func (c *Client) UpdateVCL(i *UpdateVCLInput) (*VCL, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/vcl/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "vcl", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -215,7 +214,7 @@ func (c *Client) ActivateVCL(i *ActivateVCLInput) (*VCL, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/vcl/%s/main", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "vcl", i.Name, "main") resp, err := c.Put(path, nil) if err != nil { return nil, err @@ -251,7 +250,7 @@ func (c *Client) DeleteVCL(i *DeleteVCLInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/vcl/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "vcl", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_gzip.go b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_gzip.go index b610ace84..31f534cb2 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_gzip.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_gzip.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -36,7 +35,7 @@ func (c *Client) ListGzips(i *ListGzipsInput) ([]*Gzip, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/gzip", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "gzip") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -75,7 +74,7 @@ func (c *Client) CreateGzip(i *CreateGzipInput) (*Gzip, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/gzip", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "gzip") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -111,7 +110,7 @@ func (c *Client) GetGzip(i *GetGzipInput) (*Gzip, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/gzip/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "gzip", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -155,7 +154,7 @@ func (c *Client) UpdateGzip(i *UpdateGzipInput) (*Gzip, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/gzip/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "gzip", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -191,7 +190,7 @@ func (c *Client) DeleteGzip(i *DeleteGzipInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/gzip/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "gzip", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_header.go b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_header.go index d010fdcb6..da50779ff 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_header.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_header.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -87,7 +86,7 @@ func (c *Client) ListHeaders(i *ListHeadersInput) ([]*Header, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/header", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "header") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -142,7 +141,7 @@ func (c *Client) CreateHeader(i *CreateHeaderInput) (*Header, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/header", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "header") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -178,7 +177,7 @@ func (c *Client) GetHeader(i *GetHeaderInput) (*Header, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/header/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "header", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -238,7 +237,7 @@ func (c *Client) UpdateHeader(i *UpdateHeaderInput) (*Header, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/header/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "header", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -274,7 +273,7 @@ func (c *Client) DeleteHeader(i *DeleteHeaderInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/header/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "header", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_http3.go b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_http3.go index 63499912f..4b942da82 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_http3.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_http3.go @@ -1,7 +1,7 @@ package fastly import ( - "fmt" + "strconv" "time" ) @@ -32,7 +32,7 @@ func (c *Client) GetHTTP3(i *GetHTTP3Input) (*HTTP3, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/http3", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "http3") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -66,7 +66,7 @@ func (c *Client) EnableHTTP3(i *EnableHTTP3Input) (*HTTP3, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/http3", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "http3") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -97,7 +97,7 @@ func (c *Client) DisableHTTP3(i *DisableHTTP3Input) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/http3", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "http3") resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_rate_limiter.go b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_rate_limiter.go index a3cfb1bd5..a9258f81c 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_rate_limiter.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_rate_limiter.go @@ -5,6 +5,7 @@ package fastly import ( "fmt" + "strconv" "time" ) @@ -198,7 +199,7 @@ func (c *Client) ListERLs(i *ListERLsInput) ([]*ERL, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/rate-limiters", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "rate-limiters") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -254,7 +255,7 @@ func (c *Client) CreateERL(i *CreateERLInput) (*ERL, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/rate-limiters", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "rate-limiters") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -281,7 +282,8 @@ func (c *Client) DeleteERL(i *DeleteERLInput) error { return ErrMissingERLID } - path := fmt.Sprintf("/rate-limiters/%s", i.ERLID) + path := ToSafeURL("rate-limiters", i.ERLID) + resp, err := c.Delete(path, nil) if err != nil { return err @@ -311,7 +313,8 @@ func (c *Client) GetERL(i *GetERLInput) (*ERL, error) { return nil, ErrMissingERLID } - path := fmt.Sprintf("/rate-limiters/%s", i.ERLID) + path := ToSafeURL("rate-limiters", i.ERLID) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -362,7 +365,8 @@ func (c *Client) UpdateERL(i *UpdateERLInput) (*ERL, error) { return nil, ErrMissingERLID } - path := fmt.Sprintf("/rate-limiters/%s", i.ERLID) + path := ToSafeURL("rate-limiters", i.ERLID) + resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_request_setting.go b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_request_setting.go index 828f2800e..d8f678099 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_request_setting.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_request_setting.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -80,7 +79,7 @@ func (c *Client) ListRequestSettings(i *ListRequestSettingsInput) ([]*RequestSet return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/request_settings", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "request_settings") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -136,7 +135,7 @@ func (c *Client) CreateRequestSetting(i *CreateRequestSettingInput) (*RequestSet return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/request_settings", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "request_settings") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -172,7 +171,7 @@ func (c *Client) GetRequestSetting(i *GetRequestSettingInput) (*RequestSetting, return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/request_settings/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "request_settings", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -233,7 +232,7 @@ func (c *Client) UpdateRequestSetting(i *UpdateRequestSettingInput) (*RequestSet return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/request_settings/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "request_settings", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -269,7 +268,7 @@ func (c *Client) DeleteRequestSetting(i *DeleteRequestSettingInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/request_settings/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "request_settings", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_response_object.go b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_response_object.go index 0fc4f9436..c6b2e657b 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_response_object.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_response_object.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -40,7 +39,7 @@ func (c *Client) ListResponseObjects(i *ListResponseObjectsInput) ([]*ResponseOb return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/response_object", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "response_object") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -86,7 +85,7 @@ func (c *Client) CreateResponseObject(i *CreateResponseObjectInput) (*ResponseOb return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/response_object", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "response_object") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -122,7 +121,7 @@ func (c *Client) GetResponseObject(i *GetResponseObjectInput) (*ResponseObject, return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/response_object/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "response_object", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -173,7 +172,7 @@ func (c *Client) UpdateResponseObject(i *UpdateResponseObjectInput) (*ResponseOb return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/response_object/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "response_object", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -209,7 +208,7 @@ func (c *Client) DeleteResponseObject(i *DeleteResponseObjectInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/response_object/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "response_object", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_settings.go b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_settings.go index 03e3f51b7..61c1feb01 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_settings.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_settings.go @@ -1,8 +1,6 @@ package fastly -import ( - "fmt" -) +import "strconv" // Settings represents a backend response from the Fastly API. type Settings struct { @@ -31,7 +29,7 @@ func (c *Client) GetSettings(i *GetSettingsInput) (*Settings, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/settings", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "settings") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -70,7 +68,7 @@ func (c *Client) UpdateSettings(i *UpdateSettingsInput) (*Settings, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/settings", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "settings") resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_snippets.go b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_snippets.go index 5494a9b1a..288391610 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_snippets.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/vcl_snippets.go @@ -1,8 +1,7 @@ package fastly import ( - "fmt" - "net/url" + "strconv" "time" ) @@ -86,7 +85,7 @@ func (c *Client) CreateSnippet(i *CreateSnippetInput) (*Snippet, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/snippet", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "snippet") resp, err := c.PostForm(path, i, nil) if err != nil { return nil, err @@ -130,7 +129,7 @@ func (c *Client) UpdateSnippet(i *UpdateSnippetInput) (*Snippet, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/snippet/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "snippet", i.Name) resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -173,7 +172,8 @@ func (c *Client) UpdateDynamicSnippet(i *UpdateDynamicSnippetInput) (*DynamicSni return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/snippet/%s", i.ServiceID, i.SnippetID) + path := ToSafeURL("service", i.ServiceID, "snippet", i.SnippetID) + resp, err := c.PutForm(path, i, nil) if err != nil { return nil, err @@ -209,7 +209,7 @@ func (c *Client) DeleteSnippet(i *DeleteSnippetInput) error { return ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/snippet/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "snippet", i.Name) resp, err := c.Delete(path, nil) if err != nil { return err @@ -246,7 +246,7 @@ func (c *Client) ListSnippets(i *ListSnippetsInput) ([]*Snippet, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/snippet", i.ServiceID, i.ServiceVersion) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "snippet") resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -285,7 +285,7 @@ func (c *Client) GetSnippet(i *GetSnippetInput) (*Snippet, error) { return nil, ErrMissingServiceVersion } - path := fmt.Sprintf("/service/%s/version/%d/snippet/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name)) + path := ToSafeURL("service", i.ServiceID, "version", strconv.Itoa(i.ServiceVersion), "snippet", i.Name) resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -318,7 +318,8 @@ func (c *Client) GetDynamicSnippet(i *GetDynamicSnippetInput) (*DynamicSnippet, return nil, ErrMissingServiceID } - path := fmt.Sprintf("/service/%s/snippet/%s", i.ServiceID, i.SnippetID) + path := ToSafeURL("service", i.ServiceID, "snippet", i.SnippetID) + resp, err := c.Get(path, nil) if err != nil { return nil, err diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/waf.go b/vendor/github.com/fastly/go-fastly/v9/fastly/waf.go index caa812cf3..664fd0c12 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/waf.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/waf.go @@ -186,7 +186,8 @@ func (c *Client) GetWAF(i *GetWAFInput) (*WAF, error) { return nil, ErrMissingID } - path := fmt.Sprintf("/waf/firewalls/%s", i.ID) + path := ToSafeURL("waf", "firewalls", i.ID) + resp, err := c.Get(path, &RequestOptions{ Params: map[string]string{ "filter[service_version_number]": strconv.Itoa(i.ServiceVersion), @@ -239,7 +240,8 @@ func (c *Client) UpdateWAF(i *UpdateWAFInput) (*WAF, error) { } } - path := fmt.Sprintf("/waf/firewalls/%s", i.ID) + path := ToSafeURL("waf", "firewalls", i.ID) + resp, err := c.PatchJSONAPI(path, i, nil) if err != nil { return nil, err @@ -271,7 +273,8 @@ func (c *Client) DeleteWAF(i *DeleteWAFInput) error { return ErrMissingID } - path := fmt.Sprintf("/waf/firewalls/%s", i.ID) + path := ToSafeURL("waf", "firewalls", i.ID) + _, err := c.DeleteJSONAPI(path, i, nil) return err } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/waf_active_rule.go b/vendor/github.com/fastly/go-fastly/v9/fastly/waf_active_rule.go index eeabb1585..a31d62a4b 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/waf_active_rule.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/waf_active_rule.go @@ -89,7 +89,8 @@ func (c *Client) ListWAFActiveRules(i *ListWAFActiveRulesInput) (*WAFActiveRuleR return nil, ErrMissingWAFVersionNumber } - path := fmt.Sprintf("/waf/firewalls/%s/versions/%d/active-rules", i.WAFID, i.WAFVersionNumber) + path := ToSafeURL("waf", "firewalls", i.WAFID, "versions", strconv.Itoa(i.WAFVersionNumber), "active-rules") + resp, err := c.Get(path, &RequestOptions{ Params: i.formatFilters(), }) @@ -204,7 +205,8 @@ func (c *Client) CreateWAFActiveRules(i *CreateWAFActiveRulesInput) ([]*WAFActiv return nil, ErrMissingWAFActiveRule } - path := fmt.Sprintf("/waf/firewalls/%s/versions/%d/active-rules", i.WAFID, i.WAFVersionNumber) + path := ToSafeURL("waf", "firewalls", i.WAFID, "versions", strconv.Itoa(i.WAFVersionNumber), "active-rules") + resp, err := c.PostJSONAPIBulk(path, i.Rules, nil) if err != nil { return nil, err @@ -294,7 +296,8 @@ func (c *Client) DeleteWAFActiveRules(i *DeleteWAFActiveRulesInput) error { return ErrMissingWAFActiveRule } - path := fmt.Sprintf("/waf/firewalls/%s/versions/%d/active-rules", i.WAFID, i.WAFVersionNumber) + path := ToSafeURL("waf", "firewalls", i.WAFID, "versions", strconv.Itoa(i.WAFVersionNumber), "active-rules") + _, err := c.DeleteJSONAPIBulk(path, i.Rules, nil) return err } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/waf_rule_exclusion.go b/vendor/github.com/fastly/go-fastly/v9/fastly/waf_rule_exclusion.go index 28f4c4347..c285e3851 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/waf_rule_exclusion.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/waf_rule_exclusion.go @@ -151,7 +151,8 @@ func (c *Client) ListWAFRuleExclusions(i *ListWAFRuleExclusionsInput) (*WAFRuleE return nil, ErrMissingWAFVersionNumber } - path := fmt.Sprintf("/waf/firewalls/%s/versions/%d/exclusions", i.WAFID, i.WAFVersionNumber) + path := ToSafeURL("waf", "firewalls", i.WAFID, "versions", strconv.Itoa(i.WAFVersionNumber), "exclusions") + resp, err := c.Get(path, &RequestOptions{ Params: i.formatFilters(), }) @@ -241,7 +242,8 @@ func (c *Client) CreateWAFRuleExclusion(i *CreateWAFRuleExclusionInput) (*WAFRul return nil, ErrMissingWAFRuleExclusion } - path := fmt.Sprintf("/waf/firewalls/%s/versions/%d/exclusions", i.WAFID, i.WAFVersionNumber) + path := ToSafeURL("waf", "firewalls", i.WAFID, "versions", strconv.Itoa(i.WAFVersionNumber), "exclusions") + resp, err := c.PostJSONAPI(path, i.WAFRuleExclusion, nil) if err != nil { return nil, err @@ -273,7 +275,8 @@ func (c *Client) UpdateWAFRuleExclusion(i *UpdateWAFRuleExclusionInput) (*WAFRul return nil, ErrMissingWAFRuleExclusion } - path := fmt.Sprintf("/waf/firewalls/%s/versions/%d/exclusions/%d", i.WAFID, i.WAFVersionNumber, i.Number) + path := ToSafeURL("waf", "firewalls", i.WAFID, "versions", strconv.Itoa(i.WAFVersionNumber), "exclusions", strconv.Itoa(i.Number)) + resp, err := c.PatchJSONAPI(path, i.WAFRuleExclusion, nil) if err != nil { return nil, err @@ -299,7 +302,8 @@ func (c *Client) DeleteWAFRuleExclusion(i *DeleteWAFRuleExclusionInput) error { return ErrMissingNumber } - path := fmt.Sprintf("/waf/firewalls/%s/versions/%d/exclusions/%d", i.WAFID, i.WAFVersionNumber, i.Number) + path := ToSafeURL("waf", "firewalls", i.WAFID, "versions", strconv.Itoa(i.WAFVersionNumber), "exclusions", strconv.Itoa(i.Number)) + _, err := c.Delete(path, nil) return err } diff --git a/vendor/github.com/fastly/go-fastly/v9/fastly/waf_version.go b/vendor/github.com/fastly/go-fastly/v9/fastly/waf_version.go index 9fdb228c4..82de17640 100644 --- a/vendor/github.com/fastly/go-fastly/v9/fastly/waf_version.go +++ b/vendor/github.com/fastly/go-fastly/v9/fastly/waf_version.go @@ -133,7 +133,8 @@ func (c *Client) ListWAFVersions(i *ListWAFVersionsInput) (*WAFVersionResponse, return nil, ErrMissingWAFID } - path := fmt.Sprintf("/waf/firewalls/%s/versions", i.WAFID) + path := ToSafeURL("waf", "firewalls", i.WAFID, "versions") + resp, err := c.Get(path, &RequestOptions{ Params: i.formatFilters(), }) @@ -226,7 +227,8 @@ func (c *Client) GetWAFVersion(i *GetWAFVersionInput) (*WAFVersion, error) { return nil, ErrMissingWAFVersionNumber } - path := fmt.Sprintf("/waf/firewalls/%s/versions/%d", i.WAFID, i.WAFVersionNumber) + path := ToSafeURL("waf", "firewalls", i.WAFID, "versions", strconv.Itoa(i.WAFVersionNumber)) + resp, err := c.Get(path, nil) if err != nil { return nil, err @@ -334,7 +336,8 @@ func (c *Client) UpdateWAFVersion(i *UpdateWAFVersionInput) (*WAFVersion, error) return nil, ErrMissingWAFVersionID } - path := fmt.Sprintf("/waf/firewalls/%s/versions/%d", *i.WAFID, *i.WAFVersionNumber) + path := ToSafeURL("waf", "firewalls", *i.WAFID, "versions", strconv.Itoa(*i.WAFVersionNumber)) + resp, err := c.PatchJSONAPI(path, i, nil) if err != nil { return nil, err @@ -366,7 +369,8 @@ func (c *Client) LockWAFVersion(i *LockWAFVersionInput) (*WAFVersion, error) { return nil, ErrMissingWAFVersionNumber } - path := fmt.Sprintf("/waf/firewalls/%s/versions/%d", i.WAFID, i.WAFVersionNumber) + path := ToSafeURL("waf", "firewalls", i.WAFID, "versions", strconv.Itoa(i.WAFVersionNumber)) + resp, err := c.PatchJSONAPI(path, &struct { Locked bool `jsonapi:"attr,locked"` }{true}, nil) @@ -400,7 +404,8 @@ func (c *Client) CloneWAFVersion(i *CloneWAFVersionInput) (*WAFVersion, error) { return nil, ErrMissingWAFVersionNumber } - path := fmt.Sprintf("/waf/firewalls/%s/versions/%d/clone", i.WAFID, i.WAFVersionNumber) + path := ToSafeURL("waf", "firewalls", i.WAFID, "versions", strconv.Itoa(i.WAFVersionNumber), "clone") + resp, err := c.PutJSONAPI(path, &CloneWAFVersionInput{}, nil) if err != nil { return nil, err @@ -432,7 +437,8 @@ func (c *Client) DeployWAFVersion(i *DeployWAFVersionInput) error { return ErrMissingWAFVersionNumber } - path := fmt.Sprintf("/waf/firewalls/%s/versions/%d/activate", i.WAFID, i.WAFVersionNumber) + path := ToSafeURL("waf", "firewalls", i.WAFID, "versions", strconv.Itoa(i.WAFVersionNumber), "activate") + _, err := c.PutJSONAPI(path, &DeployWAFVersionInput{}, nil) return err } @@ -451,7 +457,8 @@ func (c *Client) CreateEmptyWAFVersion(i *CreateEmptyWAFVersionInput) (*WAFVersi return nil, ErrMissingWAFID } - path := fmt.Sprintf("/waf/firewalls/%s/versions", i.WAFID) + path := ToSafeURL("waf", "firewalls", i.WAFID, "versions") + resp, err := c.PostJSONAPI(path, nil, nil) if err != nil { return nil, err diff --git a/vendor/modules.txt b/vendor/modules.txt index c2f53c146..919dc39cd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -214,7 +214,7 @@ github.com/cloudflare/circl/sign/ed448 # github.com/davecgh/go-spew v1.1.1 ## explicit github.com/davecgh/go-spew/spew -# github.com/fastly/go-fastly/v9 v9.9.0 +# github.com/fastly/go-fastly/v9 v9.10.0 ## explicit; go 1.20 github.com/fastly/go-fastly/v9/fastly # github.com/fatih/color v1.16.0