From 78c35a44c8ee083a398ea52590b6738ed13ea201 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 11 Apr 2024 02:47:06 +0000
Subject: [PATCH] feat(api): update via SDK Studio (#1759)
---
api.md | 15 +--
firewall/wafpackagerule.go | 86 +--------------
keyless_certificates/keylesscertificate.go | 12 +-
origin_tls_client_auth/hostname.go | 104 ++++++------------
origin_tls_client_auth/origintlsclientauth.go | 43 +++++++-
pagerules/pagerule.go | 78 ++++++-------
pagerules/pagerule_test.go | 24 ++--
secondary_dns/incoming.go | 10 +-
secondary_dns/incoming_test.go | 4 +-
secondary_dns/outgoing.go | 10 +-
secondary_dns/outgoing_test.go | 4 +-
secondary_dns/peer.go | 2 -
12 files changed, 151 insertions(+), 241 deletions(-)
diff --git a/api.md b/api.md
index 9ff11fe8f9a..1a7adace9ca 100644
--- a/api.md
+++ b/api.md
@@ -1892,11 +1892,11 @@ Response Types:
Methods:
-- client.KeylessCertificates.New(ctx context.Context, params keyless_certificates.KeylessCertificateNewParams) (keyless_certificates.Hostname, error)
+- client.KeylessCertificates.New(ctx context.Context, params keyless_certificates.KeylessCertificateNewParams) (keyless_certificates.KeylessCertificate, error)
- client.KeylessCertificates.List(ctx context.Context, query keyless_certificates.KeylessCertificateListParams) (pagination.SinglePage[keyless_certificates.KeylessCertificate], error)
- client.KeylessCertificates.Delete(ctx context.Context, keylessCertificateID string, params keyless_certificates.KeylessCertificateDeleteParams) (keyless_certificates.KeylessCertificateDeleteResponse, error)
-- client.KeylessCertificates.Edit(ctx context.Context, keylessCertificateID string, params keyless_certificates.KeylessCertificateEditParams) (keyless_certificates.Hostname, error)
-- client.KeylessCertificates.Get(ctx context.Context, keylessCertificateID string, query keyless_certificates.KeylessCertificateGetParams) (keyless_certificates.Hostname, error)
+- client.KeylessCertificates.Edit(ctx context.Context, keylessCertificateID string, params keyless_certificates.KeylessCertificateEditParams) (keyless_certificates.KeylessCertificate, error)
+- client.KeylessCertificates.Get(ctx context.Context, keylessCertificateID string, query keyless_certificates.KeylessCertificateGetParams) (keyless_certificates.KeylessCertificate, error)
# Logpush
@@ -2061,12 +2061,11 @@ Methods:
Response Types:
- origin_tls_client_auth.AuthenticatedOriginPull
-- origin_tls_client_auth.ID
Methods:
- client.OriginTLSClientAuth.Hostnames.Update(ctx context.Context, params origin_tls_client_auth.HostnameUpdateParams) ([]origin_tls_client_auth.AuthenticatedOriginPull, error)
-- client.OriginTLSClientAuth.Hostnames.Get(ctx context.Context, hostname string, query origin_tls_client_auth.HostnameGetParams) (origin_tls_client_auth.ID, error)
+- client.OriginTLSClientAuth.Hostnames.Get(ctx context.Context, hostname string, query origin_tls_client_auth.HostnameGetParams) (origin_tls_client_auth.AuthenticatedOriginPull, error)
### Certificates
@@ -2101,13 +2100,13 @@ Methods:
Params Types:
- pagerules.RouteParam
-- pagerules.TargesParam
+- pagerules.TargetParam
Response Types:
- pagerules.PageRule
- pagerules.Route
-- pagerules.Targes
+- pagerules.Target
- pagerules.PageruleNewResponseUnion
- pagerules.PageruleUpdateResponseUnion
- pagerules.PageruleDeleteResponse
@@ -2236,12 +2235,10 @@ Methods:
Params Types:
- secondary_dns.PeerParam
-- secondary_dns.PeersParam
Response Types:
- secondary_dns.Peer
-- secondary_dns.Peers
- secondary_dns.PeerDeleteResponse
Methods:
diff --git a/firewall/wafpackagerule.go b/firewall/wafpackagerule.go
index a53ea1691ac..50481126a48 100644
--- a/firewall/wafpackagerule.go
+++ b/firewall/wafpackagerule.go
@@ -158,7 +158,7 @@ type WAFPackageRuleListResponse struct {
AllowedModes interface{} `json:"allowed_modes"`
// When set to `on`, the current WAF rule will be used when evaluating the request.
// Applies to anomaly detection WAF rules.
- Mode WAFPackageRuleListResponseMode `json:"mode,required"`
+ Mode AllowedModesAnomaly `json:"mode,required"`
DefaultMode interface{} `json:"default_mode,required"`
JSON wafPackageRuleListResponseJSON `json:"-"`
union WAFPackageRuleListResponseUnion
@@ -243,7 +243,7 @@ type WAFPackageRuleListResponseWAFManagedRulesAnomalyRule struct {
Group WAFRuleGroup `json:"group,required"`
// When set to `on`, the current WAF rule will be used when evaluating the request.
// Applies to anomaly detection WAF rules.
- Mode WAFPackageRuleListResponseWAFManagedRulesAnomalyRuleMode `json:"mode,required"`
+ Mode AllowedModesAnomaly `json:"mode,required"`
// The unique identifier of a WAF package.
PackageID string `json:"package_id,required"`
// The order in which the individual WAF rule is executed within its rule group.
@@ -276,23 +276,6 @@ func (r wafPackageRuleListResponseWAFManagedRulesAnomalyRuleJSON) RawJSON() stri
func (r WAFPackageRuleListResponseWAFManagedRulesAnomalyRule) implementsFirewallWAFPackageRuleListResponse() {
}
-// When set to `on`, the current WAF rule will be used when evaluating the request.
-// Applies to anomaly detection WAF rules.
-type WAFPackageRuleListResponseWAFManagedRulesAnomalyRuleMode string
-
-const (
- WAFPackageRuleListResponseWAFManagedRulesAnomalyRuleModeOn WAFPackageRuleListResponseWAFManagedRulesAnomalyRuleMode = "on"
- WAFPackageRuleListResponseWAFManagedRulesAnomalyRuleModeOff WAFPackageRuleListResponseWAFManagedRulesAnomalyRuleMode = "off"
-)
-
-func (r WAFPackageRuleListResponseWAFManagedRulesAnomalyRuleMode) IsKnown() bool {
- switch r {
- case WAFPackageRuleListResponseWAFManagedRulesAnomalyRuleModeOn, WAFPackageRuleListResponseWAFManagedRulesAnomalyRuleModeOff:
- return true
- }
- return false
-}
-
// When triggered, traditional WAF rules cause the firewall to immediately act upon
// the request based on the configuration of the rule. A 'deny' rule will
// immediately respond to the request based on the configured rule action/mode (for
@@ -487,28 +470,6 @@ func (r WAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleMode) IsKno
return false
}
-// When set to `on`, the current WAF rule will be used when evaluating the request.
-// Applies to anomaly detection WAF rules.
-type WAFPackageRuleListResponseMode string
-
-const (
- WAFPackageRuleListResponseModeOn WAFPackageRuleListResponseMode = "on"
- WAFPackageRuleListResponseModeOff WAFPackageRuleListResponseMode = "off"
- WAFPackageRuleListResponseModeDefault WAFPackageRuleListResponseMode = "default"
- WAFPackageRuleListResponseModeDisable WAFPackageRuleListResponseMode = "disable"
- WAFPackageRuleListResponseModeSimulate WAFPackageRuleListResponseMode = "simulate"
- WAFPackageRuleListResponseModeBlock WAFPackageRuleListResponseMode = "block"
- WAFPackageRuleListResponseModeChallenge WAFPackageRuleListResponseMode = "challenge"
-)
-
-func (r WAFPackageRuleListResponseMode) IsKnown() bool {
- switch r {
- case WAFPackageRuleListResponseModeOn, WAFPackageRuleListResponseModeOff, WAFPackageRuleListResponseModeDefault, WAFPackageRuleListResponseModeDisable, WAFPackageRuleListResponseModeSimulate, WAFPackageRuleListResponseModeBlock, WAFPackageRuleListResponseModeChallenge:
- return true
- }
- return false
-}
-
// When triggered, anomaly detection WAF rules contribute to an overall threat
// score that will determine if a request is considered malicious. You can
// configure the total scoring threshold through the 'sensitivity' property of the
@@ -527,7 +488,7 @@ type WAFPackageRuleEditResponse struct {
AllowedModes interface{} `json:"allowed_modes"`
// When set to `on`, the current WAF rule will be used when evaluating the request.
// Applies to anomaly detection WAF rules.
- Mode WAFPackageRuleEditResponseMode `json:"mode,required"`
+ Mode AllowedModesAnomaly `json:"mode,required"`
DefaultMode interface{} `json:"default_mode,required"`
JSON wafPackageRuleEditResponseJSON `json:"-"`
union WAFPackageRuleEditResponseUnion
@@ -612,7 +573,7 @@ type WAFPackageRuleEditResponseWAFManagedRulesAnomalyRule struct {
Group WAFRuleGroup `json:"group,required"`
// When set to `on`, the current WAF rule will be used when evaluating the request.
// Applies to anomaly detection WAF rules.
- Mode WAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleMode `json:"mode,required"`
+ Mode AllowedModesAnomaly `json:"mode,required"`
// The unique identifier of a WAF package.
PackageID string `json:"package_id,required"`
// The order in which the individual WAF rule is executed within its rule group.
@@ -645,23 +606,6 @@ func (r wafPackageRuleEditResponseWAFManagedRulesAnomalyRuleJSON) RawJSON() stri
func (r WAFPackageRuleEditResponseWAFManagedRulesAnomalyRule) implementsFirewallWAFPackageRuleEditResponse() {
}
-// When set to `on`, the current WAF rule will be used when evaluating the request.
-// Applies to anomaly detection WAF rules.
-type WAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleMode string
-
-const (
- WAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleModeOn WAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleMode = "on"
- WAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleModeOff WAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleMode = "off"
-)
-
-func (r WAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleMode) IsKnown() bool {
- switch r {
- case WAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleModeOn, WAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleModeOff:
- return true
- }
- return false
-}
-
// When triggered, traditional WAF rules cause the firewall to immediately act upon
// the request based on the configuration of the rule. A 'deny' rule will
// immediately respond to the request based on the configured rule action/mode (for
@@ -856,28 +800,6 @@ func (r WAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleMode) IsKno
return false
}
-// When set to `on`, the current WAF rule will be used when evaluating the request.
-// Applies to anomaly detection WAF rules.
-type WAFPackageRuleEditResponseMode string
-
-const (
- WAFPackageRuleEditResponseModeOn WAFPackageRuleEditResponseMode = "on"
- WAFPackageRuleEditResponseModeOff WAFPackageRuleEditResponseMode = "off"
- WAFPackageRuleEditResponseModeDefault WAFPackageRuleEditResponseMode = "default"
- WAFPackageRuleEditResponseModeDisable WAFPackageRuleEditResponseMode = "disable"
- WAFPackageRuleEditResponseModeSimulate WAFPackageRuleEditResponseMode = "simulate"
- WAFPackageRuleEditResponseModeBlock WAFPackageRuleEditResponseMode = "block"
- WAFPackageRuleEditResponseModeChallenge WAFPackageRuleEditResponseMode = "challenge"
-)
-
-func (r WAFPackageRuleEditResponseMode) IsKnown() bool {
- switch r {
- case WAFPackageRuleEditResponseModeOn, WAFPackageRuleEditResponseModeOff, WAFPackageRuleEditResponseModeDefault, WAFPackageRuleEditResponseModeDisable, WAFPackageRuleEditResponseModeSimulate, WAFPackageRuleEditResponseModeBlock, WAFPackageRuleEditResponseModeChallenge:
- return true
- }
- return false
-}
-
// Union satisfied by [firewall.WAFPackageRuleGetResponseUnknown] or
// [shared.UnionString].
type WAFPackageRuleGetResponseUnion interface {
diff --git a/keyless_certificates/keylesscertificate.go b/keyless_certificates/keylesscertificate.go
index 6dd95160ff6..93a085da46a 100644
--- a/keyless_certificates/keylesscertificate.go
+++ b/keyless_certificates/keylesscertificate.go
@@ -36,7 +36,7 @@ func NewKeylessCertificateService(opts ...option.RequestOption) (r *KeylessCerti
}
// Create Keyless SSL Configuration
-func (r *KeylessCertificateService) New(ctx context.Context, params KeylessCertificateNewParams, opts ...option.RequestOption) (res *Hostname, err error) {
+func (r *KeylessCertificateService) New(ctx context.Context, params KeylessCertificateNewParams, opts ...option.RequestOption) (res *KeylessCertificate, err error) {
opts = append(r.Options[:], opts...)
var env KeylessCertificateNewResponseEnvelope
path := fmt.Sprintf("zones/%s/keyless_certificates", params.ZoneID)
@@ -86,7 +86,7 @@ func (r *KeylessCertificateService) Delete(ctx context.Context, keylessCertifica
// This will update attributes of a Keyless SSL. Consists of one or more of the
// following: host,name,port.
-func (r *KeylessCertificateService) Edit(ctx context.Context, keylessCertificateID string, params KeylessCertificateEditParams, opts ...option.RequestOption) (res *Hostname, err error) {
+func (r *KeylessCertificateService) Edit(ctx context.Context, keylessCertificateID string, params KeylessCertificateEditParams, opts ...option.RequestOption) (res *KeylessCertificate, err error) {
opts = append(r.Options[:], opts...)
var env KeylessCertificateEditResponseEnvelope
path := fmt.Sprintf("zones/%s/keyless_certificates/%s", params.ZoneID, keylessCertificateID)
@@ -99,7 +99,7 @@ func (r *KeylessCertificateService) Edit(ctx context.Context, keylessCertificate
}
// Get details for one Keyless SSL configuration.
-func (r *KeylessCertificateService) Get(ctx context.Context, keylessCertificateID string, query KeylessCertificateGetParams, opts ...option.RequestOption) (res *Hostname, err error) {
+func (r *KeylessCertificateService) Get(ctx context.Context, keylessCertificateID string, query KeylessCertificateGetParams, opts ...option.RequestOption) (res *KeylessCertificate, err error) {
opts = append(r.Options[:], opts...)
var env KeylessCertificateGetResponseEnvelope
path := fmt.Sprintf("zones/%s/keyless_certificates/%s", query.ZoneID, keylessCertificateID)
@@ -347,7 +347,7 @@ func (r KeylessCertificateNewParams) MarshalJSON() (data []byte, err error) {
type KeylessCertificateNewResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
- Result Hostname `json:"result,required"`
+ Result KeylessCertificate `json:"result,required"`
// Whether the API call was successful
Success KeylessCertificateNewResponseEnvelopeSuccess `json:"success,required"`
JSON keylessCertificateNewResponseEnvelopeJSON `json:"-"`
@@ -468,7 +468,7 @@ func (r KeylessCertificateEditParams) MarshalJSON() (data []byte, err error) {
type KeylessCertificateEditResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
- Result Hostname `json:"result,required"`
+ Result KeylessCertificate `json:"result,required"`
// Whether the API call was successful
Success KeylessCertificateEditResponseEnvelopeSuccess `json:"success,required"`
JSON keylessCertificateEditResponseEnvelopeJSON `json:"-"`
@@ -516,7 +516,7 @@ type KeylessCertificateGetParams struct {
type KeylessCertificateGetResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
- Result Hostname `json:"result,required"`
+ Result KeylessCertificate `json:"result,required"`
// Whether the API call was successful
Success KeylessCertificateGetResponseEnvelopeSuccess `json:"success,required"`
JSON keylessCertificateGetResponseEnvelopeJSON `json:"-"`
diff --git a/origin_tls_client_auth/hostname.go b/origin_tls_client_auth/hostname.go
index 58e9b0de551..ad17b87d8f0 100644
--- a/origin_tls_client_auth/hostname.go
+++ b/origin_tls_client_auth/hostname.go
@@ -52,7 +52,7 @@ func (r *HostnameService) Update(ctx context.Context, params HostnameUpdateParam
}
// Get the Hostname Status for Client Authentication
-func (r *HostnameService) Get(ctx context.Context, hostname string, query HostnameGetParams, opts ...option.RequestOption) (res *ID, err error) {
+func (r *HostnameService) Get(ctx context.Context, hostname string, query HostnameGetParams, opts ...option.RequestOption) (res *AuthenticatedOriginPull, err error) {
opts = append(r.Options[:], opts...)
var env HostnameGetResponseEnvelope
path := fmt.Sprintf("zones/%s/origin_tls_client_auth/hostnames/%s", query.ZoneID, hostname)
@@ -65,49 +65,10 @@ func (r *HostnameService) Get(ctx context.Context, hostname string, query Hostna
}
type AuthenticatedOriginPull struct {
- // Identifier
- ID string `json:"id"`
- // Identifier
- CERTID string `json:"cert_id"`
- // The hostname certificate.
- Certificate string `json:"certificate"`
- // Indicates whether hostname-level authenticated origin pulls is enabled. A null
- // value voids the association.
- Enabled bool `json:"enabled,nullable"`
- // The hostname on the origin for which the client certificate uploaded will be
- // used.
- Hostname string `json:"hostname"`
- // The hostname certificate's private key.
- PrivateKey string `json:"private_key"`
- JSON authenticatedOriginPullJSON `json:"-"`
-}
-
-// authenticatedOriginPullJSON contains the JSON metadata for the struct
-// [AuthenticatedOriginPull]
-type authenticatedOriginPullJSON struct {
- ID apijson.Field
- CERTID apijson.Field
- Certificate apijson.Field
- Enabled apijson.Field
- Hostname apijson.Field
- PrivateKey apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *AuthenticatedOriginPull) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r authenticatedOriginPullJSON) RawJSON() string {
- return r.raw
-}
-
-type ID struct {
// Identifier
CERTID string `json:"cert_id"`
// Status of the certificate or the association.
- CERTStatus IDCERTStatus `json:"cert_status"`
+ CERTStatus AuthenticatedOriginPullCERTStatus `json:"cert_status"`
// The time when the certificate was updated.
CERTUpdatedAt time.Time `json:"cert_updated_at" format:"date-time"`
// The time when the certificate was uploaded.
@@ -131,14 +92,15 @@ type ID struct {
// The type of hash used for the certificate.
Signature string `json:"signature"`
// Status of the certificate or the association.
- Status IDStatus `json:"status"`
+ Status AuthenticatedOriginPullStatus `json:"status"`
// The time when the certificate was updated.
- UpdatedAt time.Time `json:"updated_at" format:"date-time"`
- JSON idJSON `json:"-"`
+ UpdatedAt time.Time `json:"updated_at" format:"date-time"`
+ JSON authenticatedOriginPullJSON `json:"-"`
}
-// idJSON contains the JSON metadata for the struct [ID]
-type idJSON struct {
+// authenticatedOriginPullJSON contains the JSON metadata for the struct
+// [AuthenticatedOriginPull]
+type authenticatedOriginPullJSON struct {
CERTID apijson.Field
CERTStatus apijson.Field
CERTUpdatedAt apijson.Field
@@ -157,51 +119,51 @@ type idJSON struct {
ExtraFields map[string]apijson.Field
}
-func (r *ID) UnmarshalJSON(data []byte) (err error) {
+func (r *AuthenticatedOriginPull) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r idJSON) RawJSON() string {
+func (r authenticatedOriginPullJSON) RawJSON() string {
return r.raw
}
// Status of the certificate or the association.
-type IDCERTStatus string
+type AuthenticatedOriginPullCERTStatus string
const (
- IDCERTStatusInitializing IDCERTStatus = "initializing"
- IDCERTStatusPendingDeployment IDCERTStatus = "pending_deployment"
- IDCERTStatusPendingDeletion IDCERTStatus = "pending_deletion"
- IDCERTStatusActive IDCERTStatus = "active"
- IDCERTStatusDeleted IDCERTStatus = "deleted"
- IDCERTStatusDeploymentTimedOut IDCERTStatus = "deployment_timed_out"
- IDCERTStatusDeletionTimedOut IDCERTStatus = "deletion_timed_out"
+ AuthenticatedOriginPullCERTStatusInitializing AuthenticatedOriginPullCERTStatus = "initializing"
+ AuthenticatedOriginPullCERTStatusPendingDeployment AuthenticatedOriginPullCERTStatus = "pending_deployment"
+ AuthenticatedOriginPullCERTStatusPendingDeletion AuthenticatedOriginPullCERTStatus = "pending_deletion"
+ AuthenticatedOriginPullCERTStatusActive AuthenticatedOriginPullCERTStatus = "active"
+ AuthenticatedOriginPullCERTStatusDeleted AuthenticatedOriginPullCERTStatus = "deleted"
+ AuthenticatedOriginPullCERTStatusDeploymentTimedOut AuthenticatedOriginPullCERTStatus = "deployment_timed_out"
+ AuthenticatedOriginPullCERTStatusDeletionTimedOut AuthenticatedOriginPullCERTStatus = "deletion_timed_out"
)
-func (r IDCERTStatus) IsKnown() bool {
+func (r AuthenticatedOriginPullCERTStatus) IsKnown() bool {
switch r {
- case IDCERTStatusInitializing, IDCERTStatusPendingDeployment, IDCERTStatusPendingDeletion, IDCERTStatusActive, IDCERTStatusDeleted, IDCERTStatusDeploymentTimedOut, IDCERTStatusDeletionTimedOut:
+ case AuthenticatedOriginPullCERTStatusInitializing, AuthenticatedOriginPullCERTStatusPendingDeployment, AuthenticatedOriginPullCERTStatusPendingDeletion, AuthenticatedOriginPullCERTStatusActive, AuthenticatedOriginPullCERTStatusDeleted, AuthenticatedOriginPullCERTStatusDeploymentTimedOut, AuthenticatedOriginPullCERTStatusDeletionTimedOut:
return true
}
return false
}
// Status of the certificate or the association.
-type IDStatus string
+type AuthenticatedOriginPullStatus string
const (
- IDStatusInitializing IDStatus = "initializing"
- IDStatusPendingDeployment IDStatus = "pending_deployment"
- IDStatusPendingDeletion IDStatus = "pending_deletion"
- IDStatusActive IDStatus = "active"
- IDStatusDeleted IDStatus = "deleted"
- IDStatusDeploymentTimedOut IDStatus = "deployment_timed_out"
- IDStatusDeletionTimedOut IDStatus = "deletion_timed_out"
+ AuthenticatedOriginPullStatusInitializing AuthenticatedOriginPullStatus = "initializing"
+ AuthenticatedOriginPullStatusPendingDeployment AuthenticatedOriginPullStatus = "pending_deployment"
+ AuthenticatedOriginPullStatusPendingDeletion AuthenticatedOriginPullStatus = "pending_deletion"
+ AuthenticatedOriginPullStatusActive AuthenticatedOriginPullStatus = "active"
+ AuthenticatedOriginPullStatusDeleted AuthenticatedOriginPullStatus = "deleted"
+ AuthenticatedOriginPullStatusDeploymentTimedOut AuthenticatedOriginPullStatus = "deployment_timed_out"
+ AuthenticatedOriginPullStatusDeletionTimedOut AuthenticatedOriginPullStatus = "deletion_timed_out"
)
-func (r IDStatus) IsKnown() bool {
+func (r AuthenticatedOriginPullStatus) IsKnown() bool {
switch r {
- case IDStatusInitializing, IDStatusPendingDeployment, IDStatusPendingDeletion, IDStatusActive, IDStatusDeleted, IDStatusDeploymentTimedOut, IDStatusDeletionTimedOut:
+ case AuthenticatedOriginPullStatusInitializing, AuthenticatedOriginPullStatusPendingDeployment, AuthenticatedOriginPullStatusPendingDeletion, AuthenticatedOriginPullStatusActive, AuthenticatedOriginPullStatusDeleted, AuthenticatedOriginPullStatusDeploymentTimedOut, AuthenticatedOriginPullStatusDeletionTimedOut:
return true
}
return false
@@ -314,9 +276,9 @@ type HostnameGetParams struct {
}
type HostnameGetResponseEnvelope struct {
- Errors []shared.ResponseInfo `json:"errors,required"`
- Messages []shared.ResponseInfo `json:"messages,required"`
- Result ID `json:"result,required"`
+ Errors []shared.ResponseInfo `json:"errors,required"`
+ Messages []shared.ResponseInfo `json:"messages,required"`
+ Result AuthenticatedOriginPull `json:"result,required"`
// Whether the API call was successful
Success HostnameGetResponseEnvelopeSuccess `json:"success,required"`
JSON hostnameGetResponseEnvelopeJSON `json:"-"`
diff --git a/origin_tls_client_auth/origintlsclientauth.go b/origin_tls_client_auth/origintlsclientauth.go
index a98b0602fc1..1c8f62d9672 100644
--- a/origin_tls_client_auth/origintlsclientauth.go
+++ b/origin_tls_client_auth/origintlsclientauth.go
@@ -7,6 +7,7 @@ import (
"fmt"
"net/http"
"reflect"
+ "time"
"github.com/cloudflare/cloudflare-go/v2/internal/apijson"
"github.com/cloudflare/cloudflare-go/v2/internal/pagination"
@@ -110,10 +111,16 @@ type ZoneAuthenticatedOriginPull struct {
ID string `json:"id"`
// The zone's leaf certificate.
Certificate string `json:"certificate"`
- // Indicates whether zone-level authenticated origin pulls is enabled.
- Enabled bool `json:"enabled"`
- // The zone's private key.
- PrivateKey string `json:"private_key"`
+ // When the certificate from the authority expires.
+ ExpiresOn time.Time `json:"expires_on" format:"date-time"`
+ // The certificate authority that issued the certificate.
+ Issuer string `json:"issuer"`
+ // The type of hash used for the certificate.
+ Signature string `json:"signature"`
+ // Status of the certificate activation.
+ Status ZoneAuthenticatedOriginPullStatus `json:"status"`
+ // This is the time the certificate was uploaded.
+ UploadedOn time.Time `json:"uploaded_on" format:"date-time"`
JSON zoneAuthenticatedOriginPullJSON `json:"-"`
}
@@ -122,8 +129,11 @@ type ZoneAuthenticatedOriginPull struct {
type zoneAuthenticatedOriginPullJSON struct {
ID apijson.Field
Certificate apijson.Field
- Enabled apijson.Field
- PrivateKey apijson.Field
+ ExpiresOn apijson.Field
+ Issuer apijson.Field
+ Signature apijson.Field
+ Status apijson.Field
+ UploadedOn apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -136,6 +146,27 @@ func (r zoneAuthenticatedOriginPullJSON) RawJSON() string {
return r.raw
}
+// Status of the certificate activation.
+type ZoneAuthenticatedOriginPullStatus string
+
+const (
+ ZoneAuthenticatedOriginPullStatusInitializing ZoneAuthenticatedOriginPullStatus = "initializing"
+ ZoneAuthenticatedOriginPullStatusPendingDeployment ZoneAuthenticatedOriginPullStatus = "pending_deployment"
+ ZoneAuthenticatedOriginPullStatusPendingDeletion ZoneAuthenticatedOriginPullStatus = "pending_deletion"
+ ZoneAuthenticatedOriginPullStatusActive ZoneAuthenticatedOriginPullStatus = "active"
+ ZoneAuthenticatedOriginPullStatusDeleted ZoneAuthenticatedOriginPullStatus = "deleted"
+ ZoneAuthenticatedOriginPullStatusDeploymentTimedOut ZoneAuthenticatedOriginPullStatus = "deployment_timed_out"
+ ZoneAuthenticatedOriginPullStatusDeletionTimedOut ZoneAuthenticatedOriginPullStatus = "deletion_timed_out"
+)
+
+func (r ZoneAuthenticatedOriginPullStatus) IsKnown() bool {
+ switch r {
+ case ZoneAuthenticatedOriginPullStatusInitializing, ZoneAuthenticatedOriginPullStatusPendingDeployment, ZoneAuthenticatedOriginPullStatusPendingDeletion, ZoneAuthenticatedOriginPullStatusActive, ZoneAuthenticatedOriginPullStatusDeleted, ZoneAuthenticatedOriginPullStatusDeploymentTimedOut, ZoneAuthenticatedOriginPullStatusDeletionTimedOut:
+ return true
+ }
+ return false
+}
+
// Union satisfied by
// [origin_tls_client_auth.OriginTLSClientAuthNewResponseUnknown] or
// [shared.UnionString].
diff --git a/pagerules/pagerule.go b/pagerules/pagerule.go
index 3a7b042993a..552195ead40 100644
--- a/pagerules/pagerule.go
+++ b/pagerules/pagerule.go
@@ -136,7 +136,7 @@ type PageRule struct {
// The status of the Page Rule.
Status PageRuleStatus `json:"status,required"`
// The rule targets to evaluate on each request.
- Targets []Targes `json:"targets,required"`
+ Targets []Target `json:"targets,required"`
JSON pageRuleJSON `json:"-"`
}
@@ -282,113 +282,113 @@ func (r RouteValueParam) MarshalJSON() (data []byte, err error) {
}
// A request condition target.
-type Targes struct {
+type Target struct {
// String constraint.
- Constraint TargesConstraint `json:"constraint,required"`
+ Constraint TargetConstraint `json:"constraint,required"`
// A target based on the URL of the request.
- Target TargesTarget `json:"target,required"`
- JSON targesJSON `json:"-"`
+ Target TargetTarget `json:"target,required"`
+ JSON targetJSON `json:"-"`
}
-// targesJSON contains the JSON metadata for the struct [Targes]
-type targesJSON struct {
+// targetJSON contains the JSON metadata for the struct [Target]
+type targetJSON struct {
Constraint apijson.Field
Target apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *Targes) UnmarshalJSON(data []byte) (err error) {
+func (r *Target) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r targesJSON) RawJSON() string {
+func (r targetJSON) RawJSON() string {
return r.raw
}
// String constraint.
-type TargesConstraint struct {
+type TargetConstraint struct {
// The matches operator can use asterisks and pipes as wildcard and 'or' operators.
- Operator TargesConstraintOperator `json:"operator,required"`
+ Operator TargetConstraintOperator `json:"operator,required"`
// The URL pattern to match against the current request. The pattern may contain up
// to four asterisks ('\*') as placeholders.
Value string `json:"value,required"`
- JSON targesConstraintJSON `json:"-"`
+ JSON targetConstraintJSON `json:"-"`
}
-// targesConstraintJSON contains the JSON metadata for the struct
-// [TargesConstraint]
-type targesConstraintJSON struct {
+// targetConstraintJSON contains the JSON metadata for the struct
+// [TargetConstraint]
+type targetConstraintJSON struct {
Operator apijson.Field
Value apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *TargesConstraint) UnmarshalJSON(data []byte) (err error) {
+func (r *TargetConstraint) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r targesConstraintJSON) RawJSON() string {
+func (r targetConstraintJSON) RawJSON() string {
return r.raw
}
// The matches operator can use asterisks and pipes as wildcard and 'or' operators.
-type TargesConstraintOperator string
+type TargetConstraintOperator string
const (
- TargesConstraintOperatorMatches TargesConstraintOperator = "matches"
- TargesConstraintOperatorContains TargesConstraintOperator = "contains"
- TargesConstraintOperatorEquals TargesConstraintOperator = "equals"
- TargesConstraintOperatorNotEqual TargesConstraintOperator = "not_equal"
- TargesConstraintOperatorNotContain TargesConstraintOperator = "not_contain"
+ TargetConstraintOperatorMatches TargetConstraintOperator = "matches"
+ TargetConstraintOperatorContains TargetConstraintOperator = "contains"
+ TargetConstraintOperatorEquals TargetConstraintOperator = "equals"
+ TargetConstraintOperatorNotEqual TargetConstraintOperator = "not_equal"
+ TargetConstraintOperatorNotContain TargetConstraintOperator = "not_contain"
)
-func (r TargesConstraintOperator) IsKnown() bool {
+func (r TargetConstraintOperator) IsKnown() bool {
switch r {
- case TargesConstraintOperatorMatches, TargesConstraintOperatorContains, TargesConstraintOperatorEquals, TargesConstraintOperatorNotEqual, TargesConstraintOperatorNotContain:
+ case TargetConstraintOperatorMatches, TargetConstraintOperatorContains, TargetConstraintOperatorEquals, TargetConstraintOperatorNotEqual, TargetConstraintOperatorNotContain:
return true
}
return false
}
// A target based on the URL of the request.
-type TargesTarget string
+type TargetTarget string
const (
- TargesTargetURL TargesTarget = "url"
+ TargetTargetURL TargetTarget = "url"
)
-func (r TargesTarget) IsKnown() bool {
+func (r TargetTarget) IsKnown() bool {
switch r {
- case TargesTargetURL:
+ case TargetTargetURL:
return true
}
return false
}
// A request condition target.
-type TargesParam struct {
+type TargetParam struct {
// String constraint.
- Constraint param.Field[TargesConstraintParam] `json:"constraint,required"`
+ Constraint param.Field[TargetConstraintParam] `json:"constraint,required"`
// A target based on the URL of the request.
- Target param.Field[TargesTarget] `json:"target,required"`
+ Target param.Field[TargetTarget] `json:"target,required"`
}
-func (r TargesParam) MarshalJSON() (data []byte, err error) {
+func (r TargetParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// String constraint.
-type TargesConstraintParam struct {
+type TargetConstraintParam struct {
// The matches operator can use asterisks and pipes as wildcard and 'or' operators.
- Operator param.Field[TargesConstraintOperator] `json:"operator,required"`
+ Operator param.Field[TargetConstraintOperator] `json:"operator,required"`
// The URL pattern to match against the current request. The pattern may contain up
// to four asterisks ('\*') as placeholders.
Value param.Field[string] `json:"value,required"`
}
-func (r TargesConstraintParam) MarshalJSON() (data []byte, err error) {
+func (r TargetConstraintParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
@@ -489,7 +489,7 @@ type PageruleNewParams struct {
// Actions can redirect to another URL or override settings, but not both.
Actions param.Field[[]RouteParam] `json:"actions,required"`
// The rule targets to evaluate on each request.
- Targets param.Field[[]TargesParam] `json:"targets,required"`
+ Targets param.Field[[]TargetParam] `json:"targets,required"`
// The priority of the rule, used to define which Page Rule is processed over
// another. A higher number indicates a higher priority. For example, if you have a
// catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to
@@ -570,7 +570,7 @@ type PageruleUpdateParams struct {
// Actions can redirect to another URL or override settings, but not both.
Actions param.Field[[]RouteParam] `json:"actions,required"`
// The rule targets to evaluate on each request.
- Targets param.Field[[]TargesParam] `json:"targets,required"`
+ Targets param.Field[[]TargetParam] `json:"targets,required"`
// The priority of the rule, used to define which Page Rule is processed over
// another. A higher number indicates a higher priority. For example, if you have a
// catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to
@@ -842,7 +842,7 @@ type PageruleEditParams struct {
// The status of the Page Rule.
Status param.Field[PageruleEditParamsStatus] `json:"status"`
// The rule targets to evaluate on each request.
- Targets param.Field[[]TargesParam] `json:"targets"`
+ Targets param.Field[[]TargetParam] `json:"targets"`
}
func (r PageruleEditParams) MarshalJSON() (data []byte, err error) {
diff --git a/pagerules/pagerule_test.go b/pagerules/pagerule_test.go
index 59734c63a3e..6901225ca61 100644
--- a/pagerules/pagerule_test.go
+++ b/pagerules/pagerule_test.go
@@ -37,12 +37,12 @@ func TestPageruleNewWithOptionalParams(t *testing.T) {
URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"),
}),
}}),
- Targets: cloudflare.F([]pagerules.TargesParam{{
- Constraint: cloudflare.F(pagerules.TargesConstraintParam{
- Operator: cloudflare.F(pagerules.TargesConstraintOperatorMatches),
+ Targets: cloudflare.F([]pagerules.TargetParam{{
+ Constraint: cloudflare.F(pagerules.TargetConstraintParam{
+ Operator: cloudflare.F(pagerules.TargetConstraintOperatorMatches),
Value: cloudflare.F("*example.com/images/*"),
}),
- Target: cloudflare.F(pagerules.TargesTargetURL),
+ Target: cloudflare.F(pagerules.TargetTargetURL),
}}),
Priority: cloudflare.F(int64(0)),
Status: cloudflare.F(pagerules.PageruleNewParamsStatusActive),
@@ -82,12 +82,12 @@ func TestPageruleUpdateWithOptionalParams(t *testing.T) {
URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"),
}),
}}),
- Targets: cloudflare.F([]pagerules.TargesParam{{
- Constraint: cloudflare.F(pagerules.TargesConstraintParam{
- Operator: cloudflare.F(pagerules.TargesConstraintOperatorMatches),
+ Targets: cloudflare.F([]pagerules.TargetParam{{
+ Constraint: cloudflare.F(pagerules.TargetConstraintParam{
+ Operator: cloudflare.F(pagerules.TargetConstraintOperatorMatches),
Value: cloudflare.F("*example.com/images/*"),
}),
- Target: cloudflare.F(pagerules.TargesTargetURL),
+ Target: cloudflare.F(pagerules.TargetTargetURL),
}}),
Priority: cloudflare.F(int64(0)),
Status: cloudflare.F(pagerules.PageruleUpdateParamsStatusActive),
@@ -191,12 +191,12 @@ func TestPageruleEditWithOptionalParams(t *testing.T) {
}}),
Priority: cloudflare.F(int64(0)),
Status: cloudflare.F(pagerules.PageruleEditParamsStatusActive),
- Targets: cloudflare.F([]pagerules.TargesParam{{
- Constraint: cloudflare.F(pagerules.TargesConstraintParam{
- Operator: cloudflare.F(pagerules.TargesConstraintOperatorMatches),
+ Targets: cloudflare.F([]pagerules.TargetParam{{
+ Constraint: cloudflare.F(pagerules.TargetConstraintParam{
+ Operator: cloudflare.F(pagerules.TargetConstraintOperatorMatches),
Value: cloudflare.F("*example.com/images/*"),
}),
- Target: cloudflare.F(pagerules.TargesTargetURL),
+ Target: cloudflare.F(pagerules.TargetTargetURL),
}}),
},
)
diff --git a/secondary_dns/incoming.go b/secondary_dns/incoming.go
index 99c1dc1a139..f7afdfb69ff 100644
--- a/secondary_dns/incoming.go
+++ b/secondary_dns/incoming.go
@@ -97,7 +97,7 @@ type IncomingNewResponse struct {
// Zone name.
Name string `json:"name"`
// A list of peer tags.
- Peers []Peers `json:"peers"`
+ Peers []interface{} `json:"peers"`
// The serial number of the SOA for the given zone.
SoaSerial float64 `json:"soa_serial"`
JSON incomingNewResponseJSON `json:"-"`
@@ -140,7 +140,7 @@ type IncomingUpdateResponse struct {
// Zone name.
Name string `json:"name"`
// A list of peer tags.
- Peers []Peers `json:"peers"`
+ Peers []interface{} `json:"peers"`
// The serial number of the SOA for the given zone.
SoaSerial float64 `json:"soa_serial"`
JSON incomingUpdateResponseJSON `json:"-"`
@@ -204,7 +204,7 @@ type IncomingGetResponse struct {
// Zone name.
Name string `json:"name"`
// A list of peer tags.
- Peers []Peers `json:"peers"`
+ Peers []interface{} `json:"peers"`
// The serial number of the SOA for the given zone.
SoaSerial float64 `json:"soa_serial"`
JSON incomingGetResponseJSON `json:"-"`
@@ -241,7 +241,7 @@ type IncomingNewParams struct {
// Zone name.
Name param.Field[string] `json:"name,required"`
// A list of peer tags.
- Peers param.Field[[]PeersParam] `json:"peers,required"`
+ Peers param.Field[[]interface{}] `json:"peers,required"`
}
func (r IncomingNewParams) MarshalJSON() (data []byte, err error) {
@@ -299,7 +299,7 @@ type IncomingUpdateParams struct {
// Zone name.
Name param.Field[string] `json:"name,required"`
// A list of peer tags.
- Peers param.Field[[]PeersParam] `json:"peers,required"`
+ Peers param.Field[[]interface{}] `json:"peers,required"`
}
func (r IncomingUpdateParams) MarshalJSON() (data []byte, err error) {
diff --git a/secondary_dns/incoming_test.go b/secondary_dns/incoming_test.go
index 868201be144..14759a57c91 100644
--- a/secondary_dns/incoming_test.go
+++ b/secondary_dns/incoming_test.go
@@ -32,7 +32,7 @@ func TestIncomingNew(t *testing.T) {
ZoneID: cloudflare.F("269d8f4853475ca241c4e730be286b20"),
AutoRefreshSeconds: cloudflare.F(86400.000000),
Name: cloudflare.F("www.example.com."),
- Peers: cloudflare.F([]secondary_dns.PeersParam{"23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"}),
+ Peers: cloudflare.F([]interface{}{"23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"}),
})
if err != nil {
var apierr *cloudflare.Error
@@ -61,7 +61,7 @@ func TestIncomingUpdate(t *testing.T) {
ZoneID: cloudflare.F("269d8f4853475ca241c4e730be286b20"),
AutoRefreshSeconds: cloudflare.F(86400.000000),
Name: cloudflare.F("www.example.com."),
- Peers: cloudflare.F([]secondary_dns.PeersParam{"23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"}),
+ Peers: cloudflare.F([]interface{}{"23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"}),
})
if err != nil {
var apierr *cloudflare.Error
diff --git a/secondary_dns/outgoing.go b/secondary_dns/outgoing.go
index ef15c8cec46..8c8857b2789 100644
--- a/secondary_dns/outgoing.go
+++ b/secondary_dns/outgoing.go
@@ -140,7 +140,7 @@ type OutgoingNewResponse struct {
// Zone name.
Name string `json:"name"`
// A list of peer tags.
- Peers []Peers `json:"peers"`
+ Peers []interface{} `json:"peers"`
// The serial number of the SOA for the given zone.
SoaSerial float64 `json:"soa_serial"`
JSON outgoingNewResponseJSON `json:"-"`
@@ -179,7 +179,7 @@ type OutgoingUpdateResponse struct {
// Zone name.
Name string `json:"name"`
// A list of peer tags.
- Peers []Peers `json:"peers"`
+ Peers []interface{} `json:"peers"`
// The serial number of the SOA for the given zone.
SoaSerial float64 `json:"soa_serial"`
JSON outgoingUpdateResponseJSON `json:"-"`
@@ -239,7 +239,7 @@ type OutgoingGetResponse struct {
// Zone name.
Name string `json:"name"`
// A list of peer tags.
- Peers []Peers `json:"peers"`
+ Peers []interface{} `json:"peers"`
// The serial number of the SOA for the given zone.
SoaSerial float64 `json:"soa_serial"`
JSON outgoingGetResponseJSON `json:"-"`
@@ -272,7 +272,7 @@ type OutgoingNewParams struct {
// Zone name.
Name param.Field[string] `json:"name,required"`
// A list of peer tags.
- Peers param.Field[[]PeersParam] `json:"peers,required"`
+ Peers param.Field[[]interface{}] `json:"peers,required"`
}
func (r OutgoingNewParams) MarshalJSON() (data []byte, err error) {
@@ -327,7 +327,7 @@ type OutgoingUpdateParams struct {
// Zone name.
Name param.Field[string] `json:"name,required"`
// A list of peer tags.
- Peers param.Field[[]PeersParam] `json:"peers,required"`
+ Peers param.Field[[]interface{}] `json:"peers,required"`
}
func (r OutgoingUpdateParams) MarshalJSON() (data []byte, err error) {
diff --git a/secondary_dns/outgoing_test.go b/secondary_dns/outgoing_test.go
index b2e8a43448f..b8354c90450 100644
--- a/secondary_dns/outgoing_test.go
+++ b/secondary_dns/outgoing_test.go
@@ -31,7 +31,7 @@ func TestOutgoingNew(t *testing.T) {
_, err := client.SecondaryDNS.Outgoing.New(context.TODO(), secondary_dns.OutgoingNewParams{
ZoneID: cloudflare.F("269d8f4853475ca241c4e730be286b20"),
Name: cloudflare.F("www.example.com."),
- Peers: cloudflare.F([]secondary_dns.PeersParam{"23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"}),
+ Peers: cloudflare.F([]interface{}{"23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"}),
})
if err != nil {
var apierr *cloudflare.Error
@@ -59,7 +59,7 @@ func TestOutgoingUpdate(t *testing.T) {
_, err := client.SecondaryDNS.Outgoing.Update(context.TODO(), secondary_dns.OutgoingUpdateParams{
ZoneID: cloudflare.F("269d8f4853475ca241c4e730be286b20"),
Name: cloudflare.F("www.example.com."),
- Peers: cloudflare.F([]secondary_dns.PeersParam{"23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"}),
+ Peers: cloudflare.F([]interface{}{"23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"}),
})
if err != nil {
var apierr *cloudflare.Error
diff --git a/secondary_dns/peer.go b/secondary_dns/peer.go
index 1669e79c15f..4f17401a1d1 100644
--- a/secondary_dns/peer.go
+++ b/secondary_dns/peer.go
@@ -171,8 +171,6 @@ func (r PeerParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
-type Peers = interface{}
-
type PeerDeleteResponse struct {
ID string `json:"id"`
JSON peerDeleteResponseJSON `json:"-"`