diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index c008a3e4377..1a304b51fa8 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "2.0.0-beta.4"
+ ".": "2.0.0-beta.5"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 24aae68af57..cb1412e7ab3 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1 +1 @@
-configured_endpoints: 1282
+configured_endpoints: 1288
diff --git a/CHANGELOG.md b/CHANGELOG.md
index afe74cfb0a7..f6a6cde28db 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,17 @@
# Changelog
+## 2.0.0-beta.5 (2024-03-13)
+
+Full Changelog: [v2.0.0-beta.4...v2.0.0-beta.5](https://github.com/cloudflare/cloudflare-go/compare/v2.0.0-beta.4...v2.0.0-beta.5)
+
+### Features
+
+* OpenAPI spec update via Stainless API ([#1554](https://github.com/cloudflare/cloudflare-go/issues/1554)) ([9acf8f3](https://github.com/cloudflare/cloudflare-go/commit/9acf8f358779d9d9fa25a773f75a6ef12dba0197))
+* OpenAPI spec update via Stainless API ([#1555](https://github.com/cloudflare/cloudflare-go/issues/1555)) ([4252901](https://github.com/cloudflare/cloudflare-go/commit/425290104d3ef1ef6de626cfe53aa399d0852b4f))
+* OpenAPI spec update via Stainless API ([#1556](https://github.com/cloudflare/cloudflare-go/issues/1556)) ([749c6c8](https://github.com/cloudflare/cloudflare-go/commit/749c6c8cb5700c66ef1660256724dbfa5758f154))
+* OpenAPI spec update via Stainless API ([#1557](https://github.com/cloudflare/cloudflare-go/issues/1557)) ([d44a29e](https://github.com/cloudflare/cloudflare-go/commit/d44a29e34f1d1e31b25d55e1b40c85df268b666a))
+* update via SDK Studio ([#1552](https://github.com/cloudflare/cloudflare-go/issues/1552)) ([1281506](https://github.com/cloudflare/cloudflare-go/commit/1281506bd9f2e6a7ac476dd9aec6932bc721d5d5))
+
## 2.0.0-beta.4 (2024-03-12)
Full Changelog: [v2.0.0-beta.3...v2.0.0-beta.4](https://github.com/cloudflare/cloudflare-go/compare/v2.0.0-beta.3...v2.0.0-beta.4)
diff --git a/README.md b/README.md
index 344b3404bd0..c0aae655897 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ Or to pin the version:
```sh
-go get -u 'github.com/cloudflare/cloudflare-go/v2@v2.0.0-beta.4'
+go get -u 'github.com/cloudflare/cloudflare-go/v2@v2.0.0-beta.5'
```
diff --git a/alerting/v3destinationpagerduty.go b/alerting/v3destinationpagerduty.go
index db0a7bbd74a..fd812c21dd9 100644
--- a/alerting/v3destinationpagerduty.go
+++ b/alerting/v3destinationpagerduty.go
@@ -61,7 +61,7 @@ func (r *V3DestinationPagerdutyService) Delete(ctx context.Context, body V3Desti
}
// Get a list of all configured PagerDuty services.
-func (r *V3DestinationPagerdutyService) Get(ctx context.Context, query V3DestinationPagerdutyGetParams, opts ...option.RequestOption) (res *[]V3DestinationPagerdutyGetResponse, err error) {
+func (r *V3DestinationPagerdutyService) Get(ctx context.Context, query V3DestinationPagerdutyGetParams, opts ...option.RequestOption) (res *[]AaaPagerduty, err error) {
opts = append(r.Options[:], opts...)
var env V3DestinationPagerdutyGetResponseEnvelope
path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/pagerduty", query.AccountID)
@@ -86,6 +86,30 @@ func (r *V3DestinationPagerdutyService) Link(ctx context.Context, tokenID string
return
}
+type AaaPagerduty struct {
+ // UUID
+ ID string `json:"id"`
+ // The name of the pagerduty service.
+ Name string `json:"name"`
+ JSON aaaPagerdutyJSON `json:"-"`
+}
+
+// aaaPagerdutyJSON contains the JSON metadata for the struct [AaaPagerduty]
+type aaaPagerdutyJSON struct {
+ ID apijson.Field
+ Name apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AaaPagerduty) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r aaaPagerdutyJSON) RawJSON() string {
+ return r.raw
+}
+
type V3DestinationPagerdutyNewResponse struct {
// token in form of UUID
ID string `json:"id"`
@@ -134,31 +158,6 @@ type V3DestinationPagerdutyDeleteResponseArray []interface{}
func (r V3DestinationPagerdutyDeleteResponseArray) ImplementsAlertingV3DestinationPagerdutyDeleteResponse() {
}
-type V3DestinationPagerdutyGetResponse struct {
- // UUID
- ID string `json:"id"`
- // The name of the pagerduty service.
- Name string `json:"name"`
- JSON v3DestinationPagerdutyGetResponseJSON `json:"-"`
-}
-
-// v3DestinationPagerdutyGetResponseJSON contains the JSON metadata for the struct
-// [V3DestinationPagerdutyGetResponse]
-type v3DestinationPagerdutyGetResponseJSON struct {
- ID apijson.Field
- Name apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *V3DestinationPagerdutyGetResponse) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r v3DestinationPagerdutyGetResponseJSON) RawJSON() string {
- return r.raw
-}
-
type V3DestinationPagerdutyLinkResponse struct {
// UUID
ID string `json:"id"`
@@ -394,7 +393,7 @@ type V3DestinationPagerdutyGetParams struct {
type V3DestinationPagerdutyGetResponseEnvelope struct {
Errors []V3DestinationPagerdutyGetResponseEnvelopeErrors `json:"errors,required"`
Messages []V3DestinationPagerdutyGetResponseEnvelopeMessages `json:"messages,required"`
- Result []V3DestinationPagerdutyGetResponse `json:"result,required,nullable"`
+ Result []AaaPagerduty `json:"result,required,nullable"`
// Whether the API call was successful
Success V3DestinationPagerdutyGetResponseEnvelopeSuccess `json:"success,required"`
ResultInfo V3DestinationPagerdutyGetResponseEnvelopeResultInfo `json:"result_info"`
diff --git a/alerting/v3destinationwebhook.go b/alerting/v3destinationwebhook.go
index f7619d93fa4..38e303b5371 100644
--- a/alerting/v3destinationwebhook.go
+++ b/alerting/v3destinationwebhook.go
@@ -62,7 +62,7 @@ func (r *V3DestinationWebhookService) Update(ctx context.Context, webhookID stri
}
// Gets a list of all configured webhook destinations.
-func (r *V3DestinationWebhookService) List(ctx context.Context, query V3DestinationWebhookListParams, opts ...option.RequestOption) (res *[]V3DestinationWebhookListResponse, err error) {
+func (r *V3DestinationWebhookService) List(ctx context.Context, query V3DestinationWebhookListParams, opts ...option.RequestOption) (res *[]AaaWebhooks, err error) {
opts = append(r.Options[:], opts...)
var env V3DestinationWebhookListResponseEnvelope
path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/webhooks", query.AccountID)
@@ -88,7 +88,7 @@ func (r *V3DestinationWebhookService) Delete(ctx context.Context, webhookID stri
}
// Get details for a single webhooks destination.
-func (r *V3DestinationWebhookService) Get(ctx context.Context, webhookID string, query V3DestinationWebhookGetParams, opts ...option.RequestOption) (res *V3DestinationWebhookGetResponse, err error) {
+func (r *V3DestinationWebhookService) Get(ctx context.Context, webhookID string, query V3DestinationWebhookGetParams, opts ...option.RequestOption) (res *AaaWebhooks, err error) {
opts = append(r.Options[:], opts...)
var env V3DestinationWebhookGetResponseEnvelope
path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/webhooks/%s", query.AccountID, webhookID)
@@ -100,51 +100,7 @@ func (r *V3DestinationWebhookService) Get(ctx context.Context, webhookID string,
return
}
-type V3DestinationWebhookNewResponse struct {
- // UUID
- ID string `json:"id"`
- JSON v3DestinationWebhookNewResponseJSON `json:"-"`
-}
-
-// v3DestinationWebhookNewResponseJSON contains the JSON metadata for the struct
-// [V3DestinationWebhookNewResponse]
-type v3DestinationWebhookNewResponseJSON struct {
- ID apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *V3DestinationWebhookNewResponse) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r v3DestinationWebhookNewResponseJSON) RawJSON() string {
- return r.raw
-}
-
-type V3DestinationWebhookUpdateResponse struct {
- // UUID
- ID string `json:"id"`
- JSON v3DestinationWebhookUpdateResponseJSON `json:"-"`
-}
-
-// v3DestinationWebhookUpdateResponseJSON contains the JSON metadata for the struct
-// [V3DestinationWebhookUpdateResponse]
-type v3DestinationWebhookUpdateResponseJSON struct {
- ID apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *V3DestinationWebhookUpdateResponse) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r v3DestinationWebhookUpdateResponseJSON) RawJSON() string {
- return r.raw
-}
-
-type V3DestinationWebhookListResponse struct {
+type AaaWebhooks struct {
// The unique identifier of a webhook
ID string `json:"id"`
// Timestamp of when the webhook destination was created.
@@ -163,15 +119,14 @@ type V3DestinationWebhookListResponse struct {
// destinations. Secrets are not returned in any API response body.
Secret string `json:"secret"`
// Type of webhook endpoint.
- Type V3DestinationWebhookListResponseType `json:"type"`
+ Type AaaWebhooksType `json:"type"`
// The POST endpoint to call when dispatching a notification.
- URL string `json:"url"`
- JSON v3DestinationWebhookListResponseJSON `json:"-"`
+ URL string `json:"url"`
+ JSON aaaWebhooksJSON `json:"-"`
}
-// v3DestinationWebhookListResponseJSON contains the JSON metadata for the struct
-// [V3DestinationWebhookListResponse]
-type v3DestinationWebhookListResponseJSON struct {
+// aaaWebhooksJSON contains the JSON metadata for the struct [AaaWebhooks]
+type aaaWebhooksJSON struct {
ID apijson.Field
CreatedAt apijson.Field
LastFailure apijson.Field
@@ -184,23 +139,67 @@ type v3DestinationWebhookListResponseJSON struct {
ExtraFields map[string]apijson.Field
}
-func (r *V3DestinationWebhookListResponse) UnmarshalJSON(data []byte) (err error) {
+func (r *AaaWebhooks) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r v3DestinationWebhookListResponseJSON) RawJSON() string {
+func (r aaaWebhooksJSON) RawJSON() string {
return r.raw
}
// Type of webhook endpoint.
-type V3DestinationWebhookListResponseType string
+type AaaWebhooksType string
const (
- V3DestinationWebhookListResponseTypeSlack V3DestinationWebhookListResponseType = "slack"
- V3DestinationWebhookListResponseTypeGeneric V3DestinationWebhookListResponseType = "generic"
- V3DestinationWebhookListResponseTypeGchat V3DestinationWebhookListResponseType = "gchat"
+ AaaWebhooksTypeSlack AaaWebhooksType = "slack"
+ AaaWebhooksTypeGeneric AaaWebhooksType = "generic"
+ AaaWebhooksTypeGchat AaaWebhooksType = "gchat"
)
+type V3DestinationWebhookNewResponse struct {
+ // UUID
+ ID string `json:"id"`
+ JSON v3DestinationWebhookNewResponseJSON `json:"-"`
+}
+
+// v3DestinationWebhookNewResponseJSON contains the JSON metadata for the struct
+// [V3DestinationWebhookNewResponse]
+type v3DestinationWebhookNewResponseJSON struct {
+ ID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *V3DestinationWebhookNewResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r v3DestinationWebhookNewResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type V3DestinationWebhookUpdateResponse struct {
+ // UUID
+ ID string `json:"id"`
+ JSON v3DestinationWebhookUpdateResponseJSON `json:"-"`
+}
+
+// v3DestinationWebhookUpdateResponseJSON contains the JSON metadata for the struct
+// [V3DestinationWebhookUpdateResponse]
+type v3DestinationWebhookUpdateResponseJSON struct {
+ ID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *V3DestinationWebhookUpdateResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r v3DestinationWebhookUpdateResponseJSON) RawJSON() string {
+ return r.raw
+}
+
// Union satisfied by [alerting.V3DestinationWebhookDeleteResponseUnknown],
// [alerting.V3DestinationWebhookDeleteResponseArray] or [shared.UnionString].
type V3DestinationWebhookDeleteResponse interface {
@@ -227,63 +226,6 @@ type V3DestinationWebhookDeleteResponseArray []interface{}
func (r V3DestinationWebhookDeleteResponseArray) ImplementsAlertingV3DestinationWebhookDeleteResponse() {
}
-type V3DestinationWebhookGetResponse struct {
- // The unique identifier of a webhook
- ID string `json:"id"`
- // Timestamp of when the webhook destination was created.
- CreatedAt time.Time `json:"created_at" format:"date-time"`
- // Timestamp of the last time an attempt to dispatch a notification to this webhook
- // failed.
- LastFailure time.Time `json:"last_failure" format:"date-time"`
- // Timestamp of the last time Cloudflare was able to successfully dispatch a
- // notification using this webhook.
- LastSuccess time.Time `json:"last_success" format:"date-time"`
- // The name of the webhook destination. This will be included in the request body
- // when you receive a webhook notification.
- Name string `json:"name"`
- // Optional secret that will be passed in the `cf-webhook-auth` header when
- // dispatching generic webhook notifications or formatted for supported
- // destinations. Secrets are not returned in any API response body.
- Secret string `json:"secret"`
- // Type of webhook endpoint.
- Type V3DestinationWebhookGetResponseType `json:"type"`
- // The POST endpoint to call when dispatching a notification.
- URL string `json:"url"`
- JSON v3DestinationWebhookGetResponseJSON `json:"-"`
-}
-
-// v3DestinationWebhookGetResponseJSON contains the JSON metadata for the struct
-// [V3DestinationWebhookGetResponse]
-type v3DestinationWebhookGetResponseJSON struct {
- ID apijson.Field
- CreatedAt apijson.Field
- LastFailure apijson.Field
- LastSuccess apijson.Field
- Name apijson.Field
- Secret apijson.Field
- Type apijson.Field
- URL apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *V3DestinationWebhookGetResponse) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r v3DestinationWebhookGetResponseJSON) RawJSON() string {
- return r.raw
-}
-
-// Type of webhook endpoint.
-type V3DestinationWebhookGetResponseType string
-
-const (
- V3DestinationWebhookGetResponseTypeSlack V3DestinationWebhookGetResponseType = "slack"
- V3DestinationWebhookGetResponseTypeGeneric V3DestinationWebhookGetResponseType = "generic"
- V3DestinationWebhookGetResponseTypeGchat V3DestinationWebhookGetResponseType = "gchat"
-)
-
type V3DestinationWebhookNewParams struct {
// The account id
AccountID param.Field[string] `path:"account_id,required"`
@@ -490,7 +432,7 @@ type V3DestinationWebhookListParams struct {
type V3DestinationWebhookListResponseEnvelope struct {
Errors []V3DestinationWebhookListResponseEnvelopeErrors `json:"errors,required"`
Messages []V3DestinationWebhookListResponseEnvelopeMessages `json:"messages,required"`
- Result []V3DestinationWebhookListResponse `json:"result,required,nullable"`
+ Result []AaaWebhooks `json:"result,required,nullable"`
// Whether the API call was successful
Success V3DestinationWebhookListResponseEnvelopeSuccess `json:"success,required"`
ResultInfo V3DestinationWebhookListResponseEnvelopeResultInfo `json:"result_info"`
@@ -728,7 +670,7 @@ type V3DestinationWebhookGetParams struct {
type V3DestinationWebhookGetResponseEnvelope struct {
Errors []V3DestinationWebhookGetResponseEnvelopeErrors `json:"errors,required"`
Messages []V3DestinationWebhookGetResponseEnvelopeMessages `json:"messages,required"`
- Result V3DestinationWebhookGetResponse `json:"result,required"`
+ Result AaaWebhooks `json:"result,required"`
// Whether the API call was successful
Success V3DestinationWebhookGetResponseEnvelopeSuccess `json:"success,required"`
JSON v3DestinationWebhookGetResponseEnvelopeJSON `json:"-"`
diff --git a/alerting/v3history.go b/alerting/v3history.go
index c11aced3995..4d7c9e728e2 100644
--- a/alerting/v3history.go
+++ b/alerting/v3history.go
@@ -37,7 +37,7 @@ func NewV3HistoryService(opts ...option.RequestOption) (r *V3HistoryService) {
// Gets a list of history records for notifications sent to an account. The records
// are displayed for last `x` number of days based on the zone plan (free = 30, pro
// = 30, biz = 30, ent = 90).
-func (r *V3HistoryService) List(ctx context.Context, params V3HistoryListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[V3HistoryListResponse], err error) {
+func (r *V3HistoryService) List(ctx context.Context, params V3HistoryListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[AaaHistory], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
@@ -57,11 +57,11 @@ func (r *V3HistoryService) List(ctx context.Context, params V3HistoryListParams,
// Gets a list of history records for notifications sent to an account. The records
// are displayed for last `x` number of days based on the zone plan (free = 30, pro
// = 30, biz = 30, ent = 90).
-func (r *V3HistoryService) ListAutoPaging(ctx context.Context, params V3HistoryListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[V3HistoryListResponse] {
+func (r *V3HistoryService) ListAutoPaging(ctx context.Context, params V3HistoryListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[AaaHistory] {
return shared.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...))
}
-type V3HistoryListResponse struct {
+type AaaHistory struct {
// UUID
ID string `json:"id"`
// Message body included in the notification sent.
@@ -74,19 +74,18 @@ type V3HistoryListResponse struct {
Mechanism string `json:"mechanism"`
// The type of mechanism to which the notification has been dispatched. This can be
// email/pagerduty/webhook based on the mechanism configured.
- MechanismType V3HistoryListResponseMechanismType `json:"mechanism_type"`
+ MechanismType AaaHistoryMechanismType `json:"mechanism_type"`
// Name of the policy.
Name string `json:"name"`
// The unique identifier of a notification policy
PolicyID string `json:"policy_id"`
// Timestamp of when the notification was dispatched in ISO 8601 format.
- Sent time.Time `json:"sent" format:"date-time"`
- JSON v3HistoryListResponseJSON `json:"-"`
+ Sent time.Time `json:"sent" format:"date-time"`
+ JSON aaaHistoryJSON `json:"-"`
}
-// v3HistoryListResponseJSON contains the JSON metadata for the struct
-// [V3HistoryListResponse]
-type v3HistoryListResponseJSON struct {
+// aaaHistoryJSON contains the JSON metadata for the struct [AaaHistory]
+type aaaHistoryJSON struct {
ID apijson.Field
AlertBody apijson.Field
AlertType apijson.Field
@@ -100,22 +99,22 @@ type v3HistoryListResponseJSON struct {
ExtraFields map[string]apijson.Field
}
-func (r *V3HistoryListResponse) UnmarshalJSON(data []byte) (err error) {
+func (r *AaaHistory) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r v3HistoryListResponseJSON) RawJSON() string {
+func (r aaaHistoryJSON) RawJSON() string {
return r.raw
}
// The type of mechanism to which the notification has been dispatched. This can be
// email/pagerduty/webhook based on the mechanism configured.
-type V3HistoryListResponseMechanismType string
+type AaaHistoryMechanismType string
const (
- V3HistoryListResponseMechanismTypeEmail V3HistoryListResponseMechanismType = "email"
- V3HistoryListResponseMechanismTypePagerduty V3HistoryListResponseMechanismType = "pagerduty"
- V3HistoryListResponseMechanismTypeWebhook V3HistoryListResponseMechanismType = "webhook"
+ AaaHistoryMechanismTypeEmail AaaHistoryMechanismType = "email"
+ AaaHistoryMechanismTypePagerduty AaaHistoryMechanismType = "pagerduty"
+ AaaHistoryMechanismTypeWebhook AaaHistoryMechanismType = "webhook"
)
type V3HistoryListParams struct {
diff --git a/alerting/v3policy.go b/alerting/v3policy.go
index d8ed548cc0b..f74f2136c91 100644
--- a/alerting/v3policy.go
+++ b/alerting/v3policy.go
@@ -61,7 +61,7 @@ func (r *V3PolicyService) Update(ctx context.Context, policyID string, params V3
}
// Get a list of all Notification policies.
-func (r *V3PolicyService) List(ctx context.Context, query V3PolicyListParams, opts ...option.RequestOption) (res *[]V3PolicyListResponse, err error) {
+func (r *V3PolicyService) List(ctx context.Context, query V3PolicyListParams, opts ...option.RequestOption) (res *[]AaaPolicies, err error) {
opts = append(r.Options[:], opts...)
var env V3PolicyListResponseEnvelope
path := fmt.Sprintf("accounts/%s/alerting/v3/policies", query.AccountID)
@@ -87,7 +87,7 @@ func (r *V3PolicyService) Delete(ctx context.Context, policyID string, body V3Po
}
// Get details for a single policy.
-func (r *V3PolicyService) Get(ctx context.Context, policyID string, query V3PolicyGetParams, opts ...option.RequestOption) (res *V3PolicyGetResponse, err error) {
+func (r *V3PolicyService) Get(ctx context.Context, policyID string, query V3PolicyGetParams, opts ...option.RequestOption) (res *AaaPolicies, err error) {
opts = append(r.Options[:], opts...)
var env V3PolicyGetResponseEnvelope
path := fmt.Sprintf("accounts/%s/alerting/v3/policies/%s", query.AccountID, policyID)
@@ -99,58 +99,14 @@ func (r *V3PolicyService) Get(ctx context.Context, policyID string, query V3Poli
return
}
-type V3PolicyNewResponse struct {
- // UUID
- ID string `json:"id"`
- JSON v3PolicyNewResponseJSON `json:"-"`
-}
-
-// v3PolicyNewResponseJSON contains the JSON metadata for the struct
-// [V3PolicyNewResponse]
-type v3PolicyNewResponseJSON struct {
- ID apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *V3PolicyNewResponse) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r v3PolicyNewResponseJSON) RawJSON() string {
- return r.raw
-}
-
-type V3PolicyUpdateResponse struct {
- // UUID
- ID string `json:"id"`
- JSON v3PolicyUpdateResponseJSON `json:"-"`
-}
-
-// v3PolicyUpdateResponseJSON contains the JSON metadata for the struct
-// [V3PolicyUpdateResponse]
-type v3PolicyUpdateResponseJSON struct {
- ID apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *V3PolicyUpdateResponse) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r v3PolicyUpdateResponseJSON) RawJSON() string {
- return r.raw
-}
-
-type V3PolicyListResponse struct {
+type AaaPolicies struct {
// The unique identifier of a notification policy
ID string `json:"id"`
// Refers to which event will trigger a Notification dispatch. You can use the
// endpoint to get available alert types which then will give you a list of
// possible values.
- AlertType V3PolicyListResponseAlertType `json:"alert_type"`
- Created time.Time `json:"created" format:"date-time"`
+ AlertType AaaPoliciesAlertType `json:"alert_type"`
+ Created time.Time `json:"created" format:"date-time"`
// Optional description for the Notification policy.
Description string `json:"description"`
// Whether or not the Notification policy is enabled.
@@ -158,19 +114,18 @@ type V3PolicyListResponse struct {
// Optional filters that allow you to be alerted only on a subset of events for
// that alert type based on some criteria. This is only available for select alert
// types. See alert type documentation for more details.
- Filters V3PolicyListResponseFilters `json:"filters"`
+ Filters AaaPoliciesFilters `json:"filters"`
// List of IDs that will be used when dispatching a notification. IDs for email
// type will be the email address.
- Mechanisms map[string][]V3PolicyListResponseMechanisms `json:"mechanisms"`
- Modified time.Time `json:"modified" format:"date-time"`
+ Mechanisms map[string][]AaaPoliciesMechanisms `json:"mechanisms"`
+ Modified time.Time `json:"modified" format:"date-time"`
// Name of the policy.
- Name string `json:"name"`
- JSON v3PolicyListResponseJSON `json:"-"`
+ Name string `json:"name"`
+ JSON aaaPoliciesJSON `json:"-"`
}
-// v3PolicyListResponseJSON contains the JSON metadata for the struct
-// [V3PolicyListResponse]
-type v3PolicyListResponseJSON struct {
+// aaaPoliciesJSON contains the JSON metadata for the struct [AaaPolicies]
+type aaaPoliciesJSON struct {
ID apijson.Field
AlertType apijson.Field
Created apijson.Field
@@ -184,81 +139,81 @@ type v3PolicyListResponseJSON struct {
ExtraFields map[string]apijson.Field
}
-func (r *V3PolicyListResponse) UnmarshalJSON(data []byte) (err error) {
+func (r *AaaPolicies) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r v3PolicyListResponseJSON) RawJSON() string {
+func (r aaaPoliciesJSON) RawJSON() string {
return r.raw
}
// Refers to which event will trigger a Notification dispatch. You can use the
// endpoint to get available alert types which then will give you a list of
// possible values.
-type V3PolicyListResponseAlertType string
+type AaaPoliciesAlertType string
const (
- V3PolicyListResponseAlertTypeAccessCustomCertificateExpirationType V3PolicyListResponseAlertType = "access_custom_certificate_expiration_type"
- V3PolicyListResponseAlertTypeAdvancedDDOSAttackL4Alert V3PolicyListResponseAlertType = "advanced_ddos_attack_l4_alert"
- V3PolicyListResponseAlertTypeAdvancedDDOSAttackL7Alert V3PolicyListResponseAlertType = "advanced_ddos_attack_l7_alert"
- V3PolicyListResponseAlertTypeAdvancedHTTPAlertError V3PolicyListResponseAlertType = "advanced_http_alert_error"
- V3PolicyListResponseAlertTypeBGPHijackNotification V3PolicyListResponseAlertType = "bgp_hijack_notification"
- V3PolicyListResponseAlertTypeBillingUsageAlert V3PolicyListResponseAlertType = "billing_usage_alert"
- V3PolicyListResponseAlertTypeBlockNotificationBlockRemoved V3PolicyListResponseAlertType = "block_notification_block_removed"
- V3PolicyListResponseAlertTypeBlockNotificationNewBlock V3PolicyListResponseAlertType = "block_notification_new_block"
- V3PolicyListResponseAlertTypeBlockNotificationReviewRejected V3PolicyListResponseAlertType = "block_notification_review_rejected"
- V3PolicyListResponseAlertTypeBrandProtectionAlert V3PolicyListResponseAlertType = "brand_protection_alert"
- V3PolicyListResponseAlertTypeBrandProtectionDigest V3PolicyListResponseAlertType = "brand_protection_digest"
- V3PolicyListResponseAlertTypeClickhouseAlertFwAnomaly V3PolicyListResponseAlertType = "clickhouse_alert_fw_anomaly"
- V3PolicyListResponseAlertTypeClickhouseAlertFwEntAnomaly V3PolicyListResponseAlertType = "clickhouse_alert_fw_ent_anomaly"
- V3PolicyListResponseAlertTypeCustomSSLCertificateEventType V3PolicyListResponseAlertType = "custom_ssl_certificate_event_type"
- V3PolicyListResponseAlertTypeDedicatedSSLCertificateEventType V3PolicyListResponseAlertType = "dedicated_ssl_certificate_event_type"
- V3PolicyListResponseAlertTypeDosAttackL4 V3PolicyListResponseAlertType = "dos_attack_l4"
- V3PolicyListResponseAlertTypeDosAttackL7 V3PolicyListResponseAlertType = "dos_attack_l7"
- V3PolicyListResponseAlertTypeExpiringServiceTokenAlert V3PolicyListResponseAlertType = "expiring_service_token_alert"
- V3PolicyListResponseAlertTypeFailingLogpushJobDisabledAlert V3PolicyListResponseAlertType = "failing_logpush_job_disabled_alert"
- V3PolicyListResponseAlertTypeFbmAutoAdvertisement V3PolicyListResponseAlertType = "fbm_auto_advertisement"
- V3PolicyListResponseAlertTypeFbmDosdAttack V3PolicyListResponseAlertType = "fbm_dosd_attack"
- V3PolicyListResponseAlertTypeFbmVolumetricAttack V3PolicyListResponseAlertType = "fbm_volumetric_attack"
- V3PolicyListResponseAlertTypeHealthCheckStatusNotification V3PolicyListResponseAlertType = "health_check_status_notification"
- V3PolicyListResponseAlertTypeHostnameAopCustomCertificateExpirationType V3PolicyListResponseAlertType = "hostname_aop_custom_certificate_expiration_type"
- V3PolicyListResponseAlertTypeHTTPAlertEdgeError V3PolicyListResponseAlertType = "http_alert_edge_error"
- V3PolicyListResponseAlertTypeHTTPAlertOriginError V3PolicyListResponseAlertType = "http_alert_origin_error"
- V3PolicyListResponseAlertTypeIncidentAlert V3PolicyListResponseAlertType = "incident_alert"
- V3PolicyListResponseAlertTypeLoadBalancingHealthAlert V3PolicyListResponseAlertType = "load_balancing_health_alert"
- V3PolicyListResponseAlertTypeLoadBalancingPoolEnablementAlert V3PolicyListResponseAlertType = "load_balancing_pool_enablement_alert"
- V3PolicyListResponseAlertTypeLogoMatchAlert V3PolicyListResponseAlertType = "logo_match_alert"
- V3PolicyListResponseAlertTypeMagicTunnelHealthCheckEvent V3PolicyListResponseAlertType = "magic_tunnel_health_check_event"
- V3PolicyListResponseAlertTypeMaintenanceEventNotification V3PolicyListResponseAlertType = "maintenance_event_notification"
- V3PolicyListResponseAlertTypeMTLSCertificateStoreCertificateExpirationType V3PolicyListResponseAlertType = "mtls_certificate_store_certificate_expiration_type"
- V3PolicyListResponseAlertTypePagesEventAlert V3PolicyListResponseAlertType = "pages_event_alert"
- V3PolicyListResponseAlertTypeRadarNotification V3PolicyListResponseAlertType = "radar_notification"
- V3PolicyListResponseAlertTypeRealOriginMonitoring V3PolicyListResponseAlertType = "real_origin_monitoring"
- V3PolicyListResponseAlertTypeScriptmonitorAlertNewCodeChangeDetections V3PolicyListResponseAlertType = "scriptmonitor_alert_new_code_change_detections"
- V3PolicyListResponseAlertTypeScriptmonitorAlertNewHosts V3PolicyListResponseAlertType = "scriptmonitor_alert_new_hosts"
- V3PolicyListResponseAlertTypeScriptmonitorAlertNewMaliciousHosts V3PolicyListResponseAlertType = "scriptmonitor_alert_new_malicious_hosts"
- V3PolicyListResponseAlertTypeScriptmonitorAlertNewMaliciousScripts V3PolicyListResponseAlertType = "scriptmonitor_alert_new_malicious_scripts"
- V3PolicyListResponseAlertTypeScriptmonitorAlertNewMaliciousURL V3PolicyListResponseAlertType = "scriptmonitor_alert_new_malicious_url"
- V3PolicyListResponseAlertTypeScriptmonitorAlertNewMaxLengthResourceURL V3PolicyListResponseAlertType = "scriptmonitor_alert_new_max_length_resource_url"
- V3PolicyListResponseAlertTypeScriptmonitorAlertNewResources V3PolicyListResponseAlertType = "scriptmonitor_alert_new_resources"
- V3PolicyListResponseAlertTypeSecondaryDNSAllPrimariesFailing V3PolicyListResponseAlertType = "secondary_dns_all_primaries_failing"
- V3PolicyListResponseAlertTypeSecondaryDNSPrimariesFailing V3PolicyListResponseAlertType = "secondary_dns_primaries_failing"
- V3PolicyListResponseAlertTypeSecondaryDNSZoneSuccessfullyUpdated V3PolicyListResponseAlertType = "secondary_dns_zone_successfully_updated"
- V3PolicyListResponseAlertTypeSecondaryDNSZoneValidationWarning V3PolicyListResponseAlertType = "secondary_dns_zone_validation_warning"
- V3PolicyListResponseAlertTypeSentinelAlert V3PolicyListResponseAlertType = "sentinel_alert"
- V3PolicyListResponseAlertTypeStreamLiveNotifications V3PolicyListResponseAlertType = "stream_live_notifications"
- V3PolicyListResponseAlertTypeTrafficAnomaliesAlert V3PolicyListResponseAlertType = "traffic_anomalies_alert"
- V3PolicyListResponseAlertTypeTunnelHealthEvent V3PolicyListResponseAlertType = "tunnel_health_event"
- V3PolicyListResponseAlertTypeTunnelUpdateEvent V3PolicyListResponseAlertType = "tunnel_update_event"
- V3PolicyListResponseAlertTypeUniversalSSLEventType V3PolicyListResponseAlertType = "universal_ssl_event_type"
- V3PolicyListResponseAlertTypeWebAnalyticsMetricsUpdate V3PolicyListResponseAlertType = "web_analytics_metrics_update"
- V3PolicyListResponseAlertTypeZoneAopCustomCertificateExpirationType V3PolicyListResponseAlertType = "zone_aop_custom_certificate_expiration_type"
+ AaaPoliciesAlertTypeAccessCustomCertificateExpirationType AaaPoliciesAlertType = "access_custom_certificate_expiration_type"
+ AaaPoliciesAlertTypeAdvancedDDOSAttackL4Alert AaaPoliciesAlertType = "advanced_ddos_attack_l4_alert"
+ AaaPoliciesAlertTypeAdvancedDDOSAttackL7Alert AaaPoliciesAlertType = "advanced_ddos_attack_l7_alert"
+ AaaPoliciesAlertTypeAdvancedHTTPAlertError AaaPoliciesAlertType = "advanced_http_alert_error"
+ AaaPoliciesAlertTypeBGPHijackNotification AaaPoliciesAlertType = "bgp_hijack_notification"
+ AaaPoliciesAlertTypeBillingUsageAlert AaaPoliciesAlertType = "billing_usage_alert"
+ AaaPoliciesAlertTypeBlockNotificationBlockRemoved AaaPoliciesAlertType = "block_notification_block_removed"
+ AaaPoliciesAlertTypeBlockNotificationNewBlock AaaPoliciesAlertType = "block_notification_new_block"
+ AaaPoliciesAlertTypeBlockNotificationReviewRejected AaaPoliciesAlertType = "block_notification_review_rejected"
+ AaaPoliciesAlertTypeBrandProtectionAlert AaaPoliciesAlertType = "brand_protection_alert"
+ AaaPoliciesAlertTypeBrandProtectionDigest AaaPoliciesAlertType = "brand_protection_digest"
+ AaaPoliciesAlertTypeClickhouseAlertFwAnomaly AaaPoliciesAlertType = "clickhouse_alert_fw_anomaly"
+ AaaPoliciesAlertTypeClickhouseAlertFwEntAnomaly AaaPoliciesAlertType = "clickhouse_alert_fw_ent_anomaly"
+ AaaPoliciesAlertTypeCustomSSLCertificateEventType AaaPoliciesAlertType = "custom_ssl_certificate_event_type"
+ AaaPoliciesAlertTypeDedicatedSSLCertificateEventType AaaPoliciesAlertType = "dedicated_ssl_certificate_event_type"
+ AaaPoliciesAlertTypeDosAttackL4 AaaPoliciesAlertType = "dos_attack_l4"
+ AaaPoliciesAlertTypeDosAttackL7 AaaPoliciesAlertType = "dos_attack_l7"
+ AaaPoliciesAlertTypeExpiringServiceTokenAlert AaaPoliciesAlertType = "expiring_service_token_alert"
+ AaaPoliciesAlertTypeFailingLogpushJobDisabledAlert AaaPoliciesAlertType = "failing_logpush_job_disabled_alert"
+ AaaPoliciesAlertTypeFbmAutoAdvertisement AaaPoliciesAlertType = "fbm_auto_advertisement"
+ AaaPoliciesAlertTypeFbmDosdAttack AaaPoliciesAlertType = "fbm_dosd_attack"
+ AaaPoliciesAlertTypeFbmVolumetricAttack AaaPoliciesAlertType = "fbm_volumetric_attack"
+ AaaPoliciesAlertTypeHealthCheckStatusNotification AaaPoliciesAlertType = "health_check_status_notification"
+ AaaPoliciesAlertTypeHostnameAopCustomCertificateExpirationType AaaPoliciesAlertType = "hostname_aop_custom_certificate_expiration_type"
+ AaaPoliciesAlertTypeHTTPAlertEdgeError AaaPoliciesAlertType = "http_alert_edge_error"
+ AaaPoliciesAlertTypeHTTPAlertOriginError AaaPoliciesAlertType = "http_alert_origin_error"
+ AaaPoliciesAlertTypeIncidentAlert AaaPoliciesAlertType = "incident_alert"
+ AaaPoliciesAlertTypeLoadBalancingHealthAlert AaaPoliciesAlertType = "load_balancing_health_alert"
+ AaaPoliciesAlertTypeLoadBalancingPoolEnablementAlert AaaPoliciesAlertType = "load_balancing_pool_enablement_alert"
+ AaaPoliciesAlertTypeLogoMatchAlert AaaPoliciesAlertType = "logo_match_alert"
+ AaaPoliciesAlertTypeMagicTunnelHealthCheckEvent AaaPoliciesAlertType = "magic_tunnel_health_check_event"
+ AaaPoliciesAlertTypeMaintenanceEventNotification AaaPoliciesAlertType = "maintenance_event_notification"
+ AaaPoliciesAlertTypeMTLSCertificateStoreCertificateExpirationType AaaPoliciesAlertType = "mtls_certificate_store_certificate_expiration_type"
+ AaaPoliciesAlertTypePagesEventAlert AaaPoliciesAlertType = "pages_event_alert"
+ AaaPoliciesAlertTypeRadarNotification AaaPoliciesAlertType = "radar_notification"
+ AaaPoliciesAlertTypeRealOriginMonitoring AaaPoliciesAlertType = "real_origin_monitoring"
+ AaaPoliciesAlertTypeScriptmonitorAlertNewCodeChangeDetections AaaPoliciesAlertType = "scriptmonitor_alert_new_code_change_detections"
+ AaaPoliciesAlertTypeScriptmonitorAlertNewHosts AaaPoliciesAlertType = "scriptmonitor_alert_new_hosts"
+ AaaPoliciesAlertTypeScriptmonitorAlertNewMaliciousHosts AaaPoliciesAlertType = "scriptmonitor_alert_new_malicious_hosts"
+ AaaPoliciesAlertTypeScriptmonitorAlertNewMaliciousScripts AaaPoliciesAlertType = "scriptmonitor_alert_new_malicious_scripts"
+ AaaPoliciesAlertTypeScriptmonitorAlertNewMaliciousURL AaaPoliciesAlertType = "scriptmonitor_alert_new_malicious_url"
+ AaaPoliciesAlertTypeScriptmonitorAlertNewMaxLengthResourceURL AaaPoliciesAlertType = "scriptmonitor_alert_new_max_length_resource_url"
+ AaaPoliciesAlertTypeScriptmonitorAlertNewResources AaaPoliciesAlertType = "scriptmonitor_alert_new_resources"
+ AaaPoliciesAlertTypeSecondaryDNSAllPrimariesFailing AaaPoliciesAlertType = "secondary_dns_all_primaries_failing"
+ AaaPoliciesAlertTypeSecondaryDNSPrimariesFailing AaaPoliciesAlertType = "secondary_dns_primaries_failing"
+ AaaPoliciesAlertTypeSecondaryDNSZoneSuccessfullyUpdated AaaPoliciesAlertType = "secondary_dns_zone_successfully_updated"
+ AaaPoliciesAlertTypeSecondaryDNSZoneValidationWarning AaaPoliciesAlertType = "secondary_dns_zone_validation_warning"
+ AaaPoliciesAlertTypeSentinelAlert AaaPoliciesAlertType = "sentinel_alert"
+ AaaPoliciesAlertTypeStreamLiveNotifications AaaPoliciesAlertType = "stream_live_notifications"
+ AaaPoliciesAlertTypeTrafficAnomaliesAlert AaaPoliciesAlertType = "traffic_anomalies_alert"
+ AaaPoliciesAlertTypeTunnelHealthEvent AaaPoliciesAlertType = "tunnel_health_event"
+ AaaPoliciesAlertTypeTunnelUpdateEvent AaaPoliciesAlertType = "tunnel_update_event"
+ AaaPoliciesAlertTypeUniversalSSLEventType AaaPoliciesAlertType = "universal_ssl_event_type"
+ AaaPoliciesAlertTypeWebAnalyticsMetricsUpdate AaaPoliciesAlertType = "web_analytics_metrics_update"
+ AaaPoliciesAlertTypeZoneAopCustomCertificateExpirationType AaaPoliciesAlertType = "zone_aop_custom_certificate_expiration_type"
)
// Optional filters that allow you to be alerted only on a subset of events for
// that alert type based on some criteria. This is only available for select alert
// types. See alert type documentation for more details.
-type V3PolicyListResponseFilters struct {
+type AaaPoliciesFilters struct {
// Usage depends on specific alert type
Actions []string `json:"actions"`
// Used for configuring radar_notification
@@ -273,7 +228,7 @@ type V3PolicyListResponseFilters struct {
// Usage depends on specific alert type
AlertTriggerPreferences []string `json:"alert_trigger_preferences"`
// Used for configuring magic_tunnel_health_check_event
- AlertTriggerPreferencesValue []V3PolicyListResponseFiltersAlertTriggerPreferencesValue `json:"alert_trigger_preferences_value"`
+ AlertTriggerPreferencesValue []AaaPoliciesFiltersAlertTriggerPreferencesValue `json:"alert_trigger_preferences_value"`
// Used for configuring load_balancing_pool_enablement_alert
Enabled []string `json:"enabled"`
// Used for configuring pages_event_alert
@@ -289,7 +244,7 @@ type V3PolicyListResponseFilters struct {
// Used for configuring health_check_status_notification
HealthCheckID []string `json:"health_check_id"`
// Used for configuring incident_alert
- IncidentImpact []V3PolicyListResponseFiltersIncidentImpact `json:"incident_impact"`
+ IncidentImpact []AaaPoliciesFiltersIncidentImpact `json:"incident_impact"`
// Used for configuring stream_live_notifications
InputID []string `json:"input_id"`
// Used for configuring billing_usage_alert
@@ -331,7 +286,7 @@ type V3PolicyListResponseFilters struct {
// Used for configuring advanced_ddos_attack_l7_alert
TargetZoneName []string `json:"target_zone_name"`
// Used for configuring traffic_anomalies_alert
- TrafficExclusions []V3PolicyListResponseFiltersTrafficExclusion `json:"traffic_exclusions"`
+ TrafficExclusions []AaaPoliciesFiltersTrafficExclusion `json:"traffic_exclusions"`
// Used for configuring tunnel_health_event
TunnelID []string `json:"tunnel_id"`
// Used for configuring magic_tunnel_health_check_event
@@ -339,13 +294,13 @@ type V3PolicyListResponseFilters struct {
// Usage depends on specific alert type
Where []string `json:"where"`
// Usage depends on specific alert type
- Zones []string `json:"zones"`
- JSON v3PolicyListResponseFiltersJSON `json:"-"`
+ Zones []string `json:"zones"`
+ JSON aaaPoliciesFiltersJSON `json:"-"`
}
-// v3PolicyListResponseFiltersJSON contains the JSON metadata for the struct
-// [V3PolicyListResponseFilters]
-type v3PolicyListResponseFiltersJSON struct {
+// aaaPoliciesFiltersJSON contains the JSON metadata for the struct
+// [AaaPoliciesFilters]
+type aaaPoliciesFiltersJSON struct {
Actions apijson.Field
AffectedASNs apijson.Field
AffectedComponents apijson.Field
@@ -390,69 +345,69 @@ type v3PolicyListResponseFiltersJSON struct {
ExtraFields map[string]apijson.Field
}
-func (r *V3PolicyListResponseFilters) UnmarshalJSON(data []byte) (err error) {
+func (r *AaaPoliciesFilters) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r v3PolicyListResponseFiltersJSON) RawJSON() string {
+func (r aaaPoliciesFiltersJSON) RawJSON() string {
return r.raw
}
-type V3PolicyListResponseFiltersAlertTriggerPreferencesValue string
+type AaaPoliciesFiltersAlertTriggerPreferencesValue string
const (
- V3PolicyListResponseFiltersAlertTriggerPreferencesValue99_0 V3PolicyListResponseFiltersAlertTriggerPreferencesValue = "99.0"
- V3PolicyListResponseFiltersAlertTriggerPreferencesValue98_0 V3PolicyListResponseFiltersAlertTriggerPreferencesValue = "98.0"
- V3PolicyListResponseFiltersAlertTriggerPreferencesValue97_0 V3PolicyListResponseFiltersAlertTriggerPreferencesValue = "97.0"
+ AaaPoliciesFiltersAlertTriggerPreferencesValue99_0 AaaPoliciesFiltersAlertTriggerPreferencesValue = "99.0"
+ AaaPoliciesFiltersAlertTriggerPreferencesValue98_0 AaaPoliciesFiltersAlertTriggerPreferencesValue = "98.0"
+ AaaPoliciesFiltersAlertTriggerPreferencesValue97_0 AaaPoliciesFiltersAlertTriggerPreferencesValue = "97.0"
)
-type V3PolicyListResponseFiltersIncidentImpact string
+type AaaPoliciesFiltersIncidentImpact string
const (
- V3PolicyListResponseFiltersIncidentImpactIncidentImpactNone V3PolicyListResponseFiltersIncidentImpact = "INCIDENT_IMPACT_NONE"
- V3PolicyListResponseFiltersIncidentImpactIncidentImpactMinor V3PolicyListResponseFiltersIncidentImpact = "INCIDENT_IMPACT_MINOR"
- V3PolicyListResponseFiltersIncidentImpactIncidentImpactMajor V3PolicyListResponseFiltersIncidentImpact = "INCIDENT_IMPACT_MAJOR"
- V3PolicyListResponseFiltersIncidentImpactIncidentImpactCritical V3PolicyListResponseFiltersIncidentImpact = "INCIDENT_IMPACT_CRITICAL"
+ AaaPoliciesFiltersIncidentImpactIncidentImpactNone AaaPoliciesFiltersIncidentImpact = "INCIDENT_IMPACT_NONE"
+ AaaPoliciesFiltersIncidentImpactIncidentImpactMinor AaaPoliciesFiltersIncidentImpact = "INCIDENT_IMPACT_MINOR"
+ AaaPoliciesFiltersIncidentImpactIncidentImpactMajor AaaPoliciesFiltersIncidentImpact = "INCIDENT_IMPACT_MAJOR"
+ AaaPoliciesFiltersIncidentImpactIncidentImpactCritical AaaPoliciesFiltersIncidentImpact = "INCIDENT_IMPACT_CRITICAL"
)
-type V3PolicyListResponseFiltersTrafficExclusion string
+type AaaPoliciesFiltersTrafficExclusion string
const (
- V3PolicyListResponseFiltersTrafficExclusionSecurityEvents V3PolicyListResponseFiltersTrafficExclusion = "security_events"
+ AaaPoliciesFiltersTrafficExclusionSecurityEvents AaaPoliciesFiltersTrafficExclusion = "security_events"
)
-type V3PolicyListResponseMechanisms struct {
+type AaaPoliciesMechanisms struct {
// UUID
- ID V3PolicyListResponseMechanismsID `json:"id"`
- JSON v3PolicyListResponseMechanismsJSON `json:"-"`
+ ID AaaPoliciesMechanismsID `json:"id"`
+ JSON aaaPoliciesMechanismsJSON `json:"-"`
}
-// v3PolicyListResponseMechanismsJSON contains the JSON metadata for the struct
-// [V3PolicyListResponseMechanisms]
-type v3PolicyListResponseMechanismsJSON struct {
+// aaaPoliciesMechanismsJSON contains the JSON metadata for the struct
+// [AaaPoliciesMechanisms]
+type aaaPoliciesMechanismsJSON struct {
ID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *V3PolicyListResponseMechanisms) UnmarshalJSON(data []byte) (err error) {
+func (r *AaaPoliciesMechanisms) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r v3PolicyListResponseMechanismsJSON) RawJSON() string {
+func (r aaaPoliciesMechanismsJSON) RawJSON() string {
return r.raw
}
// UUID
//
// Union satisfied by [shared.UnionString] or [shared.UnionString].
-type V3PolicyListResponseMechanismsID interface {
- ImplementsAlertingV3PolicyListResponseMechanismsID()
+type AaaPoliciesMechanismsID interface {
+ ImplementsAlertingAaaPoliciesMechanismsID()
}
func init() {
apijson.RegisterUnion(
- reflect.TypeOf((*V3PolicyListResponseMechanismsID)(nil)).Elem(),
+ reflect.TypeOf((*AaaPoliciesMechanismsID)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.String,
@@ -465,345 +420,63 @@ func init() {
)
}
-// Union satisfied by [alerting.V3PolicyDeleteResponseUnknown],
-// [alerting.V3PolicyDeleteResponseArray] or [shared.UnionString].
-type V3PolicyDeleteResponse interface {
- ImplementsAlertingV3PolicyDeleteResponse()
-}
-
-func init() {
- apijson.RegisterUnion(
- reflect.TypeOf((*V3PolicyDeleteResponse)(nil)).Elem(),
- "",
- apijson.UnionVariant{
- TypeFilter: gjson.JSON,
- Type: reflect.TypeOf(V3PolicyDeleteResponseArray{}),
- },
- apijson.UnionVariant{
- TypeFilter: gjson.String,
- Type: reflect.TypeOf(shared.UnionString("")),
- },
- )
-}
-
-type V3PolicyDeleteResponseArray []interface{}
-
-func (r V3PolicyDeleteResponseArray) ImplementsAlertingV3PolicyDeleteResponse() {}
-
-type V3PolicyGetResponse struct {
- // The unique identifier of a notification policy
- ID string `json:"id"`
- // Refers to which event will trigger a Notification dispatch. You can use the
- // endpoint to get available alert types which then will give you a list of
- // possible values.
- AlertType V3PolicyGetResponseAlertType `json:"alert_type"`
- Created time.Time `json:"created" format:"date-time"`
- // Optional description for the Notification policy.
- Description string `json:"description"`
- // Whether or not the Notification policy is enabled.
- Enabled bool `json:"enabled"`
- // Optional filters that allow you to be alerted only on a subset of events for
- // that alert type based on some criteria. This is only available for select alert
- // types. See alert type documentation for more details.
- Filters V3PolicyGetResponseFilters `json:"filters"`
- // List of IDs that will be used when dispatching a notification. IDs for email
- // type will be the email address.
- Mechanisms map[string][]V3PolicyGetResponseMechanisms `json:"mechanisms"`
- Modified time.Time `json:"modified" format:"date-time"`
- // Name of the policy.
- Name string `json:"name"`
- JSON v3PolicyGetResponseJSON `json:"-"`
+type V3PolicyNewResponse struct {
+ // UUID
+ ID string `json:"id"`
+ JSON v3PolicyNewResponseJSON `json:"-"`
}
-// v3PolicyGetResponseJSON contains the JSON metadata for the struct
-// [V3PolicyGetResponse]
-type v3PolicyGetResponseJSON struct {
+// v3PolicyNewResponseJSON contains the JSON metadata for the struct
+// [V3PolicyNewResponse]
+type v3PolicyNewResponseJSON struct {
ID apijson.Field
- AlertType apijson.Field
- Created apijson.Field
- Description apijson.Field
- Enabled apijson.Field
- Filters apijson.Field
- Mechanisms apijson.Field
- Modified apijson.Field
- Name apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *V3PolicyGetResponse) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r v3PolicyGetResponseJSON) RawJSON() string {
- return r.raw
-}
-
-// Refers to which event will trigger a Notification dispatch. You can use the
-// endpoint to get available alert types which then will give you a list of
-// possible values.
-type V3PolicyGetResponseAlertType string
-
-const (
- V3PolicyGetResponseAlertTypeAccessCustomCertificateExpirationType V3PolicyGetResponseAlertType = "access_custom_certificate_expiration_type"
- V3PolicyGetResponseAlertTypeAdvancedDDOSAttackL4Alert V3PolicyGetResponseAlertType = "advanced_ddos_attack_l4_alert"
- V3PolicyGetResponseAlertTypeAdvancedDDOSAttackL7Alert V3PolicyGetResponseAlertType = "advanced_ddos_attack_l7_alert"
- V3PolicyGetResponseAlertTypeAdvancedHTTPAlertError V3PolicyGetResponseAlertType = "advanced_http_alert_error"
- V3PolicyGetResponseAlertTypeBGPHijackNotification V3PolicyGetResponseAlertType = "bgp_hijack_notification"
- V3PolicyGetResponseAlertTypeBillingUsageAlert V3PolicyGetResponseAlertType = "billing_usage_alert"
- V3PolicyGetResponseAlertTypeBlockNotificationBlockRemoved V3PolicyGetResponseAlertType = "block_notification_block_removed"
- V3PolicyGetResponseAlertTypeBlockNotificationNewBlock V3PolicyGetResponseAlertType = "block_notification_new_block"
- V3PolicyGetResponseAlertTypeBlockNotificationReviewRejected V3PolicyGetResponseAlertType = "block_notification_review_rejected"
- V3PolicyGetResponseAlertTypeBrandProtectionAlert V3PolicyGetResponseAlertType = "brand_protection_alert"
- V3PolicyGetResponseAlertTypeBrandProtectionDigest V3PolicyGetResponseAlertType = "brand_protection_digest"
- V3PolicyGetResponseAlertTypeClickhouseAlertFwAnomaly V3PolicyGetResponseAlertType = "clickhouse_alert_fw_anomaly"
- V3PolicyGetResponseAlertTypeClickhouseAlertFwEntAnomaly V3PolicyGetResponseAlertType = "clickhouse_alert_fw_ent_anomaly"
- V3PolicyGetResponseAlertTypeCustomSSLCertificateEventType V3PolicyGetResponseAlertType = "custom_ssl_certificate_event_type"
- V3PolicyGetResponseAlertTypeDedicatedSSLCertificateEventType V3PolicyGetResponseAlertType = "dedicated_ssl_certificate_event_type"
- V3PolicyGetResponseAlertTypeDosAttackL4 V3PolicyGetResponseAlertType = "dos_attack_l4"
- V3PolicyGetResponseAlertTypeDosAttackL7 V3PolicyGetResponseAlertType = "dos_attack_l7"
- V3PolicyGetResponseAlertTypeExpiringServiceTokenAlert V3PolicyGetResponseAlertType = "expiring_service_token_alert"
- V3PolicyGetResponseAlertTypeFailingLogpushJobDisabledAlert V3PolicyGetResponseAlertType = "failing_logpush_job_disabled_alert"
- V3PolicyGetResponseAlertTypeFbmAutoAdvertisement V3PolicyGetResponseAlertType = "fbm_auto_advertisement"
- V3PolicyGetResponseAlertTypeFbmDosdAttack V3PolicyGetResponseAlertType = "fbm_dosd_attack"
- V3PolicyGetResponseAlertTypeFbmVolumetricAttack V3PolicyGetResponseAlertType = "fbm_volumetric_attack"
- V3PolicyGetResponseAlertTypeHealthCheckStatusNotification V3PolicyGetResponseAlertType = "health_check_status_notification"
- V3PolicyGetResponseAlertTypeHostnameAopCustomCertificateExpirationType V3PolicyGetResponseAlertType = "hostname_aop_custom_certificate_expiration_type"
- V3PolicyGetResponseAlertTypeHTTPAlertEdgeError V3PolicyGetResponseAlertType = "http_alert_edge_error"
- V3PolicyGetResponseAlertTypeHTTPAlertOriginError V3PolicyGetResponseAlertType = "http_alert_origin_error"
- V3PolicyGetResponseAlertTypeIncidentAlert V3PolicyGetResponseAlertType = "incident_alert"
- V3PolicyGetResponseAlertTypeLoadBalancingHealthAlert V3PolicyGetResponseAlertType = "load_balancing_health_alert"
- V3PolicyGetResponseAlertTypeLoadBalancingPoolEnablementAlert V3PolicyGetResponseAlertType = "load_balancing_pool_enablement_alert"
- V3PolicyGetResponseAlertTypeLogoMatchAlert V3PolicyGetResponseAlertType = "logo_match_alert"
- V3PolicyGetResponseAlertTypeMagicTunnelHealthCheckEvent V3PolicyGetResponseAlertType = "magic_tunnel_health_check_event"
- V3PolicyGetResponseAlertTypeMaintenanceEventNotification V3PolicyGetResponseAlertType = "maintenance_event_notification"
- V3PolicyGetResponseAlertTypeMTLSCertificateStoreCertificateExpirationType V3PolicyGetResponseAlertType = "mtls_certificate_store_certificate_expiration_type"
- V3PolicyGetResponseAlertTypePagesEventAlert V3PolicyGetResponseAlertType = "pages_event_alert"
- V3PolicyGetResponseAlertTypeRadarNotification V3PolicyGetResponseAlertType = "radar_notification"
- V3PolicyGetResponseAlertTypeRealOriginMonitoring V3PolicyGetResponseAlertType = "real_origin_monitoring"
- V3PolicyGetResponseAlertTypeScriptmonitorAlertNewCodeChangeDetections V3PolicyGetResponseAlertType = "scriptmonitor_alert_new_code_change_detections"
- V3PolicyGetResponseAlertTypeScriptmonitorAlertNewHosts V3PolicyGetResponseAlertType = "scriptmonitor_alert_new_hosts"
- V3PolicyGetResponseAlertTypeScriptmonitorAlertNewMaliciousHosts V3PolicyGetResponseAlertType = "scriptmonitor_alert_new_malicious_hosts"
- V3PolicyGetResponseAlertTypeScriptmonitorAlertNewMaliciousScripts V3PolicyGetResponseAlertType = "scriptmonitor_alert_new_malicious_scripts"
- V3PolicyGetResponseAlertTypeScriptmonitorAlertNewMaliciousURL V3PolicyGetResponseAlertType = "scriptmonitor_alert_new_malicious_url"
- V3PolicyGetResponseAlertTypeScriptmonitorAlertNewMaxLengthResourceURL V3PolicyGetResponseAlertType = "scriptmonitor_alert_new_max_length_resource_url"
- V3PolicyGetResponseAlertTypeScriptmonitorAlertNewResources V3PolicyGetResponseAlertType = "scriptmonitor_alert_new_resources"
- V3PolicyGetResponseAlertTypeSecondaryDNSAllPrimariesFailing V3PolicyGetResponseAlertType = "secondary_dns_all_primaries_failing"
- V3PolicyGetResponseAlertTypeSecondaryDNSPrimariesFailing V3PolicyGetResponseAlertType = "secondary_dns_primaries_failing"
- V3PolicyGetResponseAlertTypeSecondaryDNSZoneSuccessfullyUpdated V3PolicyGetResponseAlertType = "secondary_dns_zone_successfully_updated"
- V3PolicyGetResponseAlertTypeSecondaryDNSZoneValidationWarning V3PolicyGetResponseAlertType = "secondary_dns_zone_validation_warning"
- V3PolicyGetResponseAlertTypeSentinelAlert V3PolicyGetResponseAlertType = "sentinel_alert"
- V3PolicyGetResponseAlertTypeStreamLiveNotifications V3PolicyGetResponseAlertType = "stream_live_notifications"
- V3PolicyGetResponseAlertTypeTrafficAnomaliesAlert V3PolicyGetResponseAlertType = "traffic_anomalies_alert"
- V3PolicyGetResponseAlertTypeTunnelHealthEvent V3PolicyGetResponseAlertType = "tunnel_health_event"
- V3PolicyGetResponseAlertTypeTunnelUpdateEvent V3PolicyGetResponseAlertType = "tunnel_update_event"
- V3PolicyGetResponseAlertTypeUniversalSSLEventType V3PolicyGetResponseAlertType = "universal_ssl_event_type"
- V3PolicyGetResponseAlertTypeWebAnalyticsMetricsUpdate V3PolicyGetResponseAlertType = "web_analytics_metrics_update"
- V3PolicyGetResponseAlertTypeZoneAopCustomCertificateExpirationType V3PolicyGetResponseAlertType = "zone_aop_custom_certificate_expiration_type"
-)
-
-// Optional filters that allow you to be alerted only on a subset of events for
-// that alert type based on some criteria. This is only available for select alert
-// types. See alert type documentation for more details.
-type V3PolicyGetResponseFilters struct {
- // Usage depends on specific alert type
- Actions []string `json:"actions"`
- // Used for configuring radar_notification
- AffectedASNs []string `json:"affected_asns"`
- // Used for configuring incident_alert. A list of identifiers for each component to
- // monitor.
- AffectedComponents []string `json:"affected_components"`
- // Used for configuring radar_notification
- AffectedLocations []string `json:"affected_locations"`
- // Used for configuring maintenance_event_notification
- AirportCode []string `json:"airport_code"`
- // Usage depends on specific alert type
- AlertTriggerPreferences []string `json:"alert_trigger_preferences"`
- // Used for configuring magic_tunnel_health_check_event
- AlertTriggerPreferencesValue []V3PolicyGetResponseFiltersAlertTriggerPreferencesValue `json:"alert_trigger_preferences_value"`
- // Used for configuring load_balancing_pool_enablement_alert
- Enabled []string `json:"enabled"`
- // Used for configuring pages_event_alert
- Environment []string `json:"environment"`
- // Used for configuring pages_event_alert
- Event []string `json:"event"`
- // Used for configuring load_balancing_health_alert
- EventSource []string `json:"event_source"`
- // Usage depends on specific alert type
- EventType []string `json:"event_type"`
- // Usage depends on specific alert type
- GroupBy []string `json:"group_by"`
- // Used for configuring health_check_status_notification
- HealthCheckID []string `json:"health_check_id"`
- // Used for configuring incident_alert
- IncidentImpact []V3PolicyGetResponseFiltersIncidentImpact `json:"incident_impact"`
- // Used for configuring stream_live_notifications
- InputID []string `json:"input_id"`
- // Used for configuring billing_usage_alert
- Limit []string `json:"limit"`
- // Used for configuring logo_match_alert
- LogoTag []string `json:"logo_tag"`
- // Used for configuring advanced_ddos_attack_l4_alert
- MegabitsPerSecond []string `json:"megabits_per_second"`
- // Used for configuring load_balancing_health_alert
- NewHealth []string `json:"new_health"`
- // Used for configuring tunnel_health_event
- NewStatus []string `json:"new_status"`
- // Used for configuring advanced_ddos_attack_l4_alert
- PacketsPerSecond []string `json:"packets_per_second"`
- // Usage depends on specific alert type
- PoolID []string `json:"pool_id"`
- // Used for configuring billing_usage_alert
- Product []string `json:"product"`
- // Used for configuring pages_event_alert
- ProjectID []string `json:"project_id"`
- // Used for configuring advanced_ddos_attack_l4_alert
- Protocol []string `json:"protocol"`
- // Usage depends on specific alert type
- QueryTag []string `json:"query_tag"`
- // Used for configuring advanced_ddos_attack_l7_alert
- RequestsPerSecond []string `json:"requests_per_second"`
- // Usage depends on specific alert type
- Selectors []string `json:"selectors"`
- // Used for configuring clickhouse_alert_fw_ent_anomaly
- Services []string `json:"services"`
- // Usage depends on specific alert type
- Slo []string `json:"slo"`
- // Used for configuring health_check_status_notification
- Status []string `json:"status"`
- // Used for configuring advanced_ddos_attack_l7_alert
- TargetHostname []string `json:"target_hostname"`
- // Used for configuring advanced_ddos_attack_l4_alert
- TargetIP []string `json:"target_ip"`
- // Used for configuring advanced_ddos_attack_l7_alert
- TargetZoneName []string `json:"target_zone_name"`
- // Used for configuring traffic_anomalies_alert
- TrafficExclusions []V3PolicyGetResponseFiltersTrafficExclusion `json:"traffic_exclusions"`
- // Used for configuring tunnel_health_event
- TunnelID []string `json:"tunnel_id"`
- // Used for configuring magic_tunnel_health_check_event
- TunnelName []string `json:"tunnel_name"`
- // Usage depends on specific alert type
- Where []string `json:"where"`
- // Usage depends on specific alert type
- Zones []string `json:"zones"`
- JSON v3PolicyGetResponseFiltersJSON `json:"-"`
-}
-
-// v3PolicyGetResponseFiltersJSON contains the JSON metadata for the struct
-// [V3PolicyGetResponseFilters]
-type v3PolicyGetResponseFiltersJSON struct {
- Actions apijson.Field
- AffectedASNs apijson.Field
- AffectedComponents apijson.Field
- AffectedLocations apijson.Field
- AirportCode apijson.Field
- AlertTriggerPreferences apijson.Field
- AlertTriggerPreferencesValue apijson.Field
- Enabled apijson.Field
- Environment apijson.Field
- Event apijson.Field
- EventSource apijson.Field
- EventType apijson.Field
- GroupBy apijson.Field
- HealthCheckID apijson.Field
- IncidentImpact apijson.Field
- InputID apijson.Field
- Limit apijson.Field
- LogoTag apijson.Field
- MegabitsPerSecond apijson.Field
- NewHealth apijson.Field
- NewStatus apijson.Field
- PacketsPerSecond apijson.Field
- PoolID apijson.Field
- Product apijson.Field
- ProjectID apijson.Field
- Protocol apijson.Field
- QueryTag apijson.Field
- RequestsPerSecond apijson.Field
- Selectors apijson.Field
- Services apijson.Field
- Slo apijson.Field
- Status apijson.Field
- TargetHostname apijson.Field
- TargetIP apijson.Field
- TargetZoneName apijson.Field
- TrafficExclusions apijson.Field
- TunnelID apijson.Field
- TunnelName apijson.Field
- Where apijson.Field
- Zones apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *V3PolicyGetResponseFilters) UnmarshalJSON(data []byte) (err error) {
+func (r *V3PolicyNewResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r v3PolicyGetResponseFiltersJSON) RawJSON() string {
+func (r v3PolicyNewResponseJSON) RawJSON() string {
return r.raw
}
-type V3PolicyGetResponseFiltersAlertTriggerPreferencesValue string
-
-const (
- V3PolicyGetResponseFiltersAlertTriggerPreferencesValue99_0 V3PolicyGetResponseFiltersAlertTriggerPreferencesValue = "99.0"
- V3PolicyGetResponseFiltersAlertTriggerPreferencesValue98_0 V3PolicyGetResponseFiltersAlertTriggerPreferencesValue = "98.0"
- V3PolicyGetResponseFiltersAlertTriggerPreferencesValue97_0 V3PolicyGetResponseFiltersAlertTriggerPreferencesValue = "97.0"
-)
-
-type V3PolicyGetResponseFiltersIncidentImpact string
-
-const (
- V3PolicyGetResponseFiltersIncidentImpactIncidentImpactNone V3PolicyGetResponseFiltersIncidentImpact = "INCIDENT_IMPACT_NONE"
- V3PolicyGetResponseFiltersIncidentImpactIncidentImpactMinor V3PolicyGetResponseFiltersIncidentImpact = "INCIDENT_IMPACT_MINOR"
- V3PolicyGetResponseFiltersIncidentImpactIncidentImpactMajor V3PolicyGetResponseFiltersIncidentImpact = "INCIDENT_IMPACT_MAJOR"
- V3PolicyGetResponseFiltersIncidentImpactIncidentImpactCritical V3PolicyGetResponseFiltersIncidentImpact = "INCIDENT_IMPACT_CRITICAL"
-)
-
-type V3PolicyGetResponseFiltersTrafficExclusion string
-
-const (
- V3PolicyGetResponseFiltersTrafficExclusionSecurityEvents V3PolicyGetResponseFiltersTrafficExclusion = "security_events"
-)
-
-type V3PolicyGetResponseMechanisms struct {
+type V3PolicyUpdateResponse struct {
// UUID
- ID V3PolicyGetResponseMechanismsID `json:"id"`
- JSON v3PolicyGetResponseMechanismsJSON `json:"-"`
+ ID string `json:"id"`
+ JSON v3PolicyUpdateResponseJSON `json:"-"`
}
-// v3PolicyGetResponseMechanismsJSON contains the JSON metadata for the struct
-// [V3PolicyGetResponseMechanisms]
-type v3PolicyGetResponseMechanismsJSON struct {
+// v3PolicyUpdateResponseJSON contains the JSON metadata for the struct
+// [V3PolicyUpdateResponse]
+type v3PolicyUpdateResponseJSON struct {
ID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *V3PolicyGetResponseMechanisms) UnmarshalJSON(data []byte) (err error) {
+func (r *V3PolicyUpdateResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r v3PolicyGetResponseMechanismsJSON) RawJSON() string {
+func (r v3PolicyUpdateResponseJSON) RawJSON() string {
return r.raw
}
-// UUID
-//
-// Union satisfied by [shared.UnionString] or [shared.UnionString].
-type V3PolicyGetResponseMechanismsID interface {
- ImplementsAlertingV3PolicyGetResponseMechanismsID()
+// Union satisfied by [alerting.V3PolicyDeleteResponseUnknown],
+// [alerting.V3PolicyDeleteResponseArray] or [shared.UnionString].
+type V3PolicyDeleteResponse interface {
+ ImplementsAlertingV3PolicyDeleteResponse()
}
func init() {
apijson.RegisterUnion(
- reflect.TypeOf((*V3PolicyGetResponseMechanismsID)(nil)).Elem(),
+ reflect.TypeOf((*V3PolicyDeleteResponse)(nil)).Elem(),
"",
apijson.UnionVariant{
- TypeFilter: gjson.String,
- Type: reflect.TypeOf(shared.UnionString("")),
+ TypeFilter: gjson.JSON,
+ Type: reflect.TypeOf(V3PolicyDeleteResponseArray{}),
},
apijson.UnionVariant{
TypeFilter: gjson.String,
@@ -812,6 +485,10 @@ func init() {
)
}
+type V3PolicyDeleteResponseArray []interface{}
+
+func (r V3PolicyDeleteResponseArray) ImplementsAlertingV3PolicyDeleteResponse() {}
+
type V3PolicyNewParams struct {
// The account id
AccountID param.Field[string] `path:"account_id,required"`
@@ -1420,7 +1097,7 @@ type V3PolicyListParams struct {
type V3PolicyListResponseEnvelope struct {
Errors []V3PolicyListResponseEnvelopeErrors `json:"errors,required"`
Messages []V3PolicyListResponseEnvelopeMessages `json:"messages,required"`
- Result []V3PolicyListResponse `json:"result,required,nullable"`
+ Result []AaaPolicies `json:"result,required,nullable"`
// Whether the API call was successful
Success V3PolicyListResponseEnvelopeSuccess `json:"success,required"`
ResultInfo V3PolicyListResponseEnvelopeResultInfo `json:"result_info"`
@@ -1658,7 +1335,7 @@ type V3PolicyGetParams struct {
type V3PolicyGetResponseEnvelope struct {
Errors []V3PolicyGetResponseEnvelopeErrors `json:"errors,required"`
Messages []V3PolicyGetResponseEnvelopeMessages `json:"messages,required"`
- Result V3PolicyGetResponse `json:"result,required"`
+ Result AaaPolicies `json:"result,required"`
// Whether the API call was successful
Success V3PolicyGetResponseEnvelopeSuccess `json:"success,required"`
JSON v3PolicyGetResponseEnvelopeJSON `json:"-"`
diff --git a/api.md b/api.md
index 6a4de255232..992c1233508 100644
--- a/api.md
+++ b/api.md
@@ -4002,63 +4002,61 @@ Methods:
Response Types:
+- alerting.AaaPagerduty
- alerting.V3DestinationPagerdutyNewResponse
- alerting.V3DestinationPagerdutyDeleteResponse
-- alerting.V3DestinationPagerdutyGetResponse
- alerting.V3DestinationPagerdutyLinkResponse
Methods:
- client.Alerting.V3.Destinations.Pagerduty.New(ctx context.Context, body alerting.V3DestinationPagerdutyNewParams) (alerting.V3DestinationPagerdutyNewResponse, error)
- client.Alerting.V3.Destinations.Pagerduty.Delete(ctx context.Context, body alerting.V3DestinationPagerdutyDeleteParams) (alerting.V3DestinationPagerdutyDeleteResponse, error)
-- client.Alerting.V3.Destinations.Pagerduty.Get(ctx context.Context, query alerting.V3DestinationPagerdutyGetParams) ([]alerting.V3DestinationPagerdutyGetResponse, error)
+- client.Alerting.V3.Destinations.Pagerduty.Get(ctx context.Context, query alerting.V3DestinationPagerdutyGetParams) ([]alerting.AaaPagerduty, error)
- client.Alerting.V3.Destinations.Pagerduty.Link(ctx context.Context, tokenID string, query alerting.V3DestinationPagerdutyLinkParams) (alerting.V3DestinationPagerdutyLinkResponse, error)
#### Webhooks
Response Types:
+- alerting.AaaWebhooks
- alerting.V3DestinationWebhookNewResponse
- alerting.V3DestinationWebhookUpdateResponse
-- alerting.V3DestinationWebhookListResponse
- alerting.V3DestinationWebhookDeleteResponse
-- alerting.V3DestinationWebhookGetResponse
Methods:
- client.Alerting.V3.Destinations.Webhooks.New(ctx context.Context, params alerting.V3DestinationWebhookNewParams) (alerting.V3DestinationWebhookNewResponse, error)
- client.Alerting.V3.Destinations.Webhooks.Update(ctx context.Context, webhookID string, params alerting.V3DestinationWebhookUpdateParams) (alerting.V3DestinationWebhookUpdateResponse, error)
-- client.Alerting.V3.Destinations.Webhooks.List(ctx context.Context, query alerting.V3DestinationWebhookListParams) ([]alerting.V3DestinationWebhookListResponse, error)
+- client.Alerting.V3.Destinations.Webhooks.List(ctx context.Context, query alerting.V3DestinationWebhookListParams) ([]alerting.AaaWebhooks, error)
- client.Alerting.V3.Destinations.Webhooks.Delete(ctx context.Context, webhookID string, body alerting.V3DestinationWebhookDeleteParams) (alerting.V3DestinationWebhookDeleteResponse, error)
-- client.Alerting.V3.Destinations.Webhooks.Get(ctx context.Context, webhookID string, query alerting.V3DestinationWebhookGetParams) (alerting.V3DestinationWebhookGetResponse, error)
+- client.Alerting.V3.Destinations.Webhooks.Get(ctx context.Context, webhookID string, query alerting.V3DestinationWebhookGetParams) (alerting.AaaWebhooks, error)
### Histories
Response Types:
-- alerting.V3HistoryListResponse
+- alerting.AaaHistory
Methods:
-- client.Alerting.V3.Histories.List(ctx context.Context, params alerting.V3HistoryListParams) (shared.V4PagePaginationArray[alerting.V3HistoryListResponse], error)
+- client.Alerting.V3.Histories.List(ctx context.Context, params alerting.V3HistoryListParams) (shared.V4PagePaginationArray[alerting.AaaHistory], error)
### Policies
Response Types:
+- alerting.AaaPolicies
- alerting.V3PolicyNewResponse
- alerting.V3PolicyUpdateResponse
-- alerting.V3PolicyListResponse
- alerting.V3PolicyDeleteResponse
-- alerting.V3PolicyGetResponse
Methods:
- client.Alerting.V3.Policies.New(ctx context.Context, params alerting.V3PolicyNewParams) (alerting.V3PolicyNewResponse, error)
- client.Alerting.V3.Policies.Update(ctx context.Context, policyID string, params alerting.V3PolicyUpdateParams) (alerting.V3PolicyUpdateResponse, error)
-- client.Alerting.V3.Policies.List(ctx context.Context, query alerting.V3PolicyListParams) ([]alerting.V3PolicyListResponse, error)
+- client.Alerting.V3.Policies.List(ctx context.Context, query alerting.V3PolicyListParams) ([]alerting.AaaPolicies, error)
- client.Alerting.V3.Policies.Delete(ctx context.Context, policyID string, body alerting.V3PolicyDeleteParams) (alerting.V3PolicyDeleteResponse, error)
-- client.Alerting.V3.Policies.Get(ctx context.Context, policyID string, query alerting.V3PolicyGetParams) (alerting.V3PolicyGetResponse, error)
+- client.Alerting.V3.Policies.Get(ctx context.Context, policyID string, query alerting.V3PolicyGetParams) (alerting.AaaPolicies, error)
# D1
@@ -5111,6 +5109,20 @@ Methods:
## Widgets
+Response Types:
+
+- challenges.NcChallengesAdminWidgetDetail
+- challenges.NcChallengesAdminWidgetList
+
+Methods:
+
+- client.Challenges.Widgets.New(ctx context.Context, params challenges.WidgetNewParams) (challenges.NcChallengesAdminWidgetDetail, error)
+- client.Challenges.Widgets.Update(ctx context.Context, sitekey string, params challenges.WidgetUpdateParams) (challenges.NcChallengesAdminWidgetDetail, error)
+- client.Challenges.Widgets.List(ctx context.Context, params challenges.WidgetListParams) (shared.V4PagePaginationArray[challenges.NcChallengesAdminWidgetList], error)
+- client.Challenges.Widgets.Delete(ctx context.Context, sitekey string, body challenges.WidgetDeleteParams) (challenges.NcChallengesAdminWidgetDetail, error)
+- client.Challenges.Widgets.Get(ctx context.Context, sitekey string, query challenges.WidgetGetParams) (challenges.NcChallengesAdminWidgetDetail, error)
+- client.Challenges.Widgets.RotateSecret(ctx context.Context, sitekey string, params challenges.WidgetRotateSecretParams) (challenges.NcChallengesAdminWidgetDetail, error)
+
# Hyperdrive
## Configs
diff --git a/challenges/widget.go b/challenges/widget.go
index e2a0ba7e7ce..a48302a71f3 100644
--- a/challenges/widget.go
+++ b/challenges/widget.go
@@ -3,6 +3,17 @@
package challenges
import (
+ "context"
+ "fmt"
+ "net/http"
+ "net/url"
+ "time"
+
+ "github.com/cloudflare/cloudflare-go/v2/internal/apijson"
+ "github.com/cloudflare/cloudflare-go/v2/internal/apiquery"
+ "github.com/cloudflare/cloudflare-go/v2/internal/param"
+ "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig"
+ "github.com/cloudflare/cloudflare-go/v2/internal/shared"
"github.com/cloudflare/cloudflare-go/v2/option"
)
@@ -22,3 +33,860 @@ func NewWidgetService(opts ...option.RequestOption) (r *WidgetService) {
r.Options = opts
return
}
+
+// Lists challenge widgets.
+func (r *WidgetService) New(ctx context.Context, params WidgetNewParams, opts ...option.RequestOption) (res *NcChallengesAdminWidgetDetail, err error) {
+ opts = append(r.Options[:], opts...)
+ var env WidgetNewResponseEnvelope
+ path := fmt.Sprintf("accounts/%s/challenges/widgets", params.AccountID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...)
+ if err != nil {
+ return
+ }
+ res = &env.Result
+ return
+}
+
+// Update the configuration of a widget.
+func (r *WidgetService) Update(ctx context.Context, sitekey string, params WidgetUpdateParams, opts ...option.RequestOption) (res *NcChallengesAdminWidgetDetail, err error) {
+ opts = append(r.Options[:], opts...)
+ var env WidgetUpdateResponseEnvelope
+ path := fmt.Sprintf("accounts/%s/challenges/widgets/%s", params.AccountID, sitekey)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...)
+ if err != nil {
+ return
+ }
+ res = &env.Result
+ return
+}
+
+// Lists all turnstile widgets of an account.
+func (r *WidgetService) List(ctx context.Context, params WidgetListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[NcChallengesAdminWidgetList], err error) {
+ var raw *http.Response
+ opts = append(r.Options, opts...)
+ opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
+ path := fmt.Sprintf("accounts/%s/challenges/widgets", params.AccountID)
+ cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...)
+ if err != nil {
+ return nil, err
+ }
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+// Lists all turnstile widgets of an account.
+func (r *WidgetService) ListAutoPaging(ctx context.Context, params WidgetListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[NcChallengesAdminWidgetList] {
+ return shared.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...))
+}
+
+// Destroy a Turnstile Widget.
+func (r *WidgetService) Delete(ctx context.Context, sitekey string, body WidgetDeleteParams, opts ...option.RequestOption) (res *NcChallengesAdminWidgetDetail, err error) {
+ opts = append(r.Options[:], opts...)
+ var env WidgetDeleteResponseEnvelope
+ path := fmt.Sprintf("accounts/%s/challenges/widgets/%s", body.AccountID, sitekey)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...)
+ if err != nil {
+ return
+ }
+ res = &env.Result
+ return
+}
+
+// Show a single challenge widget configuration.
+func (r *WidgetService) Get(ctx context.Context, sitekey string, query WidgetGetParams, opts ...option.RequestOption) (res *NcChallengesAdminWidgetDetail, err error) {
+ opts = append(r.Options[:], opts...)
+ var env WidgetGetResponseEnvelope
+ path := fmt.Sprintf("accounts/%s/challenges/widgets/%s", query.AccountID, sitekey)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
+ if err != nil {
+ return
+ }
+ res = &env.Result
+ return
+}
+
+// Generate a new secret key for this widget. If `invalidate_immediately` is set to
+// `false`, the previous secret remains valid for 2 hours.
+//
+// Note that secrets cannot be rotated again during the grace period.
+func (r *WidgetService) RotateSecret(ctx context.Context, sitekey string, params WidgetRotateSecretParams, opts ...option.RequestOption) (res *NcChallengesAdminWidgetDetail, err error) {
+ opts = append(r.Options[:], opts...)
+ var env WidgetRotateSecretResponseEnvelope
+ path := fmt.Sprintf("accounts/%s/challenges/widgets/%s/rotate_secret", params.AccountID, sitekey)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...)
+ if err != nil {
+ return
+ }
+ res = &env.Result
+ return
+}
+
+// A Turnstile widget's detailed configuration
+type NcChallengesAdminWidgetDetail struct {
+ // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive
+ // challenges in response to malicious bots (ENT only).
+ BotFightMode bool `json:"bot_fight_mode,required"`
+ // If Turnstile is embedded on a Cloudflare site and the widget should grant
+ // challenge clearance, this setting can determine the clearance level to be set
+ ClearanceLevel NcChallengesAdminWidgetDetailClearanceLevel `json:"clearance_level,required"`
+ // When the widget was created.
+ CreatedOn time.Time `json:"created_on,required" format:"date-time"`
+ Domains []string `json:"domains,required"`
+ // Widget Mode
+ Mode NcChallengesAdminWidgetDetailMode `json:"mode,required"`
+ // When the widget was modified.
+ ModifiedOn time.Time `json:"modified_on,required" format:"date-time"`
+ // Human readable widget name. Not unique. Cloudflare suggests that you set this to
+ // a meaningful string to make it easier to identify your widget, and where it is
+ // used.
+ Name string `json:"name,required"`
+ // Do not show any Cloudflare branding on the widget (ENT only).
+ Offlabel bool `json:"offlabel,required"`
+ // Region where this widget can be used.
+ Region NcChallengesAdminWidgetDetailRegion `json:"region,required"`
+ // Secret key for this widget.
+ Secret string `json:"secret,required"`
+ // Widget item identifier tag.
+ Sitekey string `json:"sitekey,required"`
+ JSON ncChallengesAdminWidgetDetailJSON `json:"-"`
+}
+
+// ncChallengesAdminWidgetDetailJSON contains the JSON metadata for the struct
+// [NcChallengesAdminWidgetDetail]
+type ncChallengesAdminWidgetDetailJSON struct {
+ BotFightMode apijson.Field
+ ClearanceLevel apijson.Field
+ CreatedOn apijson.Field
+ Domains apijson.Field
+ Mode apijson.Field
+ ModifiedOn apijson.Field
+ Name apijson.Field
+ Offlabel apijson.Field
+ Region apijson.Field
+ Secret apijson.Field
+ Sitekey apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *NcChallengesAdminWidgetDetail) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r ncChallengesAdminWidgetDetailJSON) RawJSON() string {
+ return r.raw
+}
+
+// If Turnstile is embedded on a Cloudflare site and the widget should grant
+// challenge clearance, this setting can determine the clearance level to be set
+type NcChallengesAdminWidgetDetailClearanceLevel string
+
+const (
+ NcChallengesAdminWidgetDetailClearanceLevelNoClearance NcChallengesAdminWidgetDetailClearanceLevel = "no_clearance"
+ NcChallengesAdminWidgetDetailClearanceLevelJschallenge NcChallengesAdminWidgetDetailClearanceLevel = "jschallenge"
+ NcChallengesAdminWidgetDetailClearanceLevelManaged NcChallengesAdminWidgetDetailClearanceLevel = "managed"
+ NcChallengesAdminWidgetDetailClearanceLevelInteractive NcChallengesAdminWidgetDetailClearanceLevel = "interactive"
+)
+
+// Widget Mode
+type NcChallengesAdminWidgetDetailMode string
+
+const (
+ NcChallengesAdminWidgetDetailModeNonInteractive NcChallengesAdminWidgetDetailMode = "non-interactive"
+ NcChallengesAdminWidgetDetailModeInvisible NcChallengesAdminWidgetDetailMode = "invisible"
+ NcChallengesAdminWidgetDetailModeManaged NcChallengesAdminWidgetDetailMode = "managed"
+)
+
+// Region where this widget can be used.
+type NcChallengesAdminWidgetDetailRegion string
+
+const (
+ NcChallengesAdminWidgetDetailRegionWorld NcChallengesAdminWidgetDetailRegion = "world"
+)
+
+// A Turnstile Widgets configuration as it appears in listings
+type NcChallengesAdminWidgetList struct {
+ // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive
+ // challenges in response to malicious bots (ENT only).
+ BotFightMode bool `json:"bot_fight_mode,required"`
+ // If Turnstile is embedded on a Cloudflare site and the widget should grant
+ // challenge clearance, this setting can determine the clearance level to be set
+ ClearanceLevel NcChallengesAdminWidgetListClearanceLevel `json:"clearance_level,required"`
+ // When the widget was created.
+ CreatedOn time.Time `json:"created_on,required" format:"date-time"`
+ Domains []string `json:"domains,required"`
+ // Widget Mode
+ Mode NcChallengesAdminWidgetListMode `json:"mode,required"`
+ // When the widget was modified.
+ ModifiedOn time.Time `json:"modified_on,required" format:"date-time"`
+ // Human readable widget name. Not unique. Cloudflare suggests that you set this to
+ // a meaningful string to make it easier to identify your widget, and where it is
+ // used.
+ Name string `json:"name,required"`
+ // Do not show any Cloudflare branding on the widget (ENT only).
+ Offlabel bool `json:"offlabel,required"`
+ // Region where this widget can be used.
+ Region NcChallengesAdminWidgetListRegion `json:"region,required"`
+ // Widget item identifier tag.
+ Sitekey string `json:"sitekey,required"`
+ JSON ncChallengesAdminWidgetListJSON `json:"-"`
+}
+
+// ncChallengesAdminWidgetListJSON contains the JSON metadata for the struct
+// [NcChallengesAdminWidgetList]
+type ncChallengesAdminWidgetListJSON struct {
+ BotFightMode apijson.Field
+ ClearanceLevel apijson.Field
+ CreatedOn apijson.Field
+ Domains apijson.Field
+ Mode apijson.Field
+ ModifiedOn apijson.Field
+ Name apijson.Field
+ Offlabel apijson.Field
+ Region apijson.Field
+ Sitekey apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *NcChallengesAdminWidgetList) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r ncChallengesAdminWidgetListJSON) RawJSON() string {
+ return r.raw
+}
+
+// If Turnstile is embedded on a Cloudflare site and the widget should grant
+// challenge clearance, this setting can determine the clearance level to be set
+type NcChallengesAdminWidgetListClearanceLevel string
+
+const (
+ NcChallengesAdminWidgetListClearanceLevelNoClearance NcChallengesAdminWidgetListClearanceLevel = "no_clearance"
+ NcChallengesAdminWidgetListClearanceLevelJschallenge NcChallengesAdminWidgetListClearanceLevel = "jschallenge"
+ NcChallengesAdminWidgetListClearanceLevelManaged NcChallengesAdminWidgetListClearanceLevel = "managed"
+ NcChallengesAdminWidgetListClearanceLevelInteractive NcChallengesAdminWidgetListClearanceLevel = "interactive"
+)
+
+// Widget Mode
+type NcChallengesAdminWidgetListMode string
+
+const (
+ NcChallengesAdminWidgetListModeNonInteractive NcChallengesAdminWidgetListMode = "non-interactive"
+ NcChallengesAdminWidgetListModeInvisible NcChallengesAdminWidgetListMode = "invisible"
+ NcChallengesAdminWidgetListModeManaged NcChallengesAdminWidgetListMode = "managed"
+)
+
+// Region where this widget can be used.
+type NcChallengesAdminWidgetListRegion string
+
+const (
+ NcChallengesAdminWidgetListRegionWorld NcChallengesAdminWidgetListRegion = "world"
+)
+
+type WidgetNewParams struct {
+ // Identifier
+ AccountID param.Field[string] `path:"account_id,required"`
+ Domains param.Field[[]string] `json:"domains,required"`
+ // Widget Mode
+ Mode param.Field[WidgetNewParamsMode] `json:"mode,required"`
+ // Human readable widget name. Not unique. Cloudflare suggests that you set this to
+ // a meaningful string to make it easier to identify your widget, and where it is
+ // used.
+ Name param.Field[string] `json:"name,required"`
+ // Direction to order widgets.
+ Direction param.Field[WidgetNewParamsDirection] `query:"direction"`
+ // Field to order widgets by.
+ Order param.Field[WidgetNewParamsOrder] `query:"order"`
+ // Page number of paginated results.
+ Page param.Field[float64] `query:"page"`
+ // Number of items per page.
+ PerPage param.Field[float64] `query:"per_page"`
+ // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive
+ // challenges in response to malicious bots (ENT only).
+ BotFightMode param.Field[bool] `json:"bot_fight_mode"`
+ // If Turnstile is embedded on a Cloudflare site and the widget should grant
+ // challenge clearance, this setting can determine the clearance level to be set
+ ClearanceLevel param.Field[WidgetNewParamsClearanceLevel] `json:"clearance_level"`
+ // Do not show any Cloudflare branding on the widget (ENT only).
+ Offlabel param.Field[bool] `json:"offlabel"`
+ // Region where this widget can be used.
+ Region param.Field[WidgetNewParamsRegion] `json:"region"`
+}
+
+func (r WidgetNewParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// URLQuery serializes [WidgetNewParams]'s query parameters as `url.Values`.
+func (r WidgetNewParams) URLQuery() (v url.Values) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+// Widget Mode
+type WidgetNewParamsMode string
+
+const (
+ WidgetNewParamsModeNonInteractive WidgetNewParamsMode = "non-interactive"
+ WidgetNewParamsModeInvisible WidgetNewParamsMode = "invisible"
+ WidgetNewParamsModeManaged WidgetNewParamsMode = "managed"
+)
+
+// Direction to order widgets.
+type WidgetNewParamsDirection string
+
+const (
+ WidgetNewParamsDirectionAsc WidgetNewParamsDirection = "asc"
+ WidgetNewParamsDirectionDesc WidgetNewParamsDirection = "desc"
+)
+
+// Field to order widgets by.
+type WidgetNewParamsOrder string
+
+const (
+ WidgetNewParamsOrderID WidgetNewParamsOrder = "id"
+ WidgetNewParamsOrderSitekey WidgetNewParamsOrder = "sitekey"
+ WidgetNewParamsOrderName WidgetNewParamsOrder = "name"
+ WidgetNewParamsOrderCreatedOn WidgetNewParamsOrder = "created_on"
+ WidgetNewParamsOrderModifiedOn WidgetNewParamsOrder = "modified_on"
+)
+
+// If Turnstile is embedded on a Cloudflare site and the widget should grant
+// challenge clearance, this setting can determine the clearance level to be set
+type WidgetNewParamsClearanceLevel string
+
+const (
+ WidgetNewParamsClearanceLevelNoClearance WidgetNewParamsClearanceLevel = "no_clearance"
+ WidgetNewParamsClearanceLevelJschallenge WidgetNewParamsClearanceLevel = "jschallenge"
+ WidgetNewParamsClearanceLevelManaged WidgetNewParamsClearanceLevel = "managed"
+ WidgetNewParamsClearanceLevelInteractive WidgetNewParamsClearanceLevel = "interactive"
+)
+
+// Region where this widget can be used.
+type WidgetNewParamsRegion string
+
+const (
+ WidgetNewParamsRegionWorld WidgetNewParamsRegion = "world"
+)
+
+type WidgetNewResponseEnvelope struct {
+ Errors []WidgetNewResponseEnvelopeErrors `json:"errors,required"`
+ Messages []WidgetNewResponseEnvelopeMessages `json:"messages,required"`
+ // Whether the API call was successful
+ Success bool `json:"success,required"`
+ // A Turnstile widget's detailed configuration
+ Result NcChallengesAdminWidgetDetail `json:"result"`
+ ResultInfo WidgetNewResponseEnvelopeResultInfo `json:"result_info"`
+ JSON widgetNewResponseEnvelopeJSON `json:"-"`
+}
+
+// widgetNewResponseEnvelopeJSON contains the JSON metadata for the struct
+// [WidgetNewResponseEnvelope]
+type widgetNewResponseEnvelopeJSON struct {
+ Errors apijson.Field
+ Messages apijson.Field
+ Success apijson.Field
+ Result apijson.Field
+ ResultInfo apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetNewResponseEnvelopeJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetNewResponseEnvelopeErrors struct {
+ Code int64 `json:"code,required"`
+ Message string `json:"message,required"`
+ JSON widgetNewResponseEnvelopeErrorsJSON `json:"-"`
+}
+
+// widgetNewResponseEnvelopeErrorsJSON contains the JSON metadata for the struct
+// [WidgetNewResponseEnvelopeErrors]
+type widgetNewResponseEnvelopeErrorsJSON struct {
+ Code apijson.Field
+ Message apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetNewResponseEnvelopeErrorsJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetNewResponseEnvelopeMessages struct {
+ Code int64 `json:"code,required"`
+ Message string `json:"message,required"`
+ JSON widgetNewResponseEnvelopeMessagesJSON `json:"-"`
+}
+
+// widgetNewResponseEnvelopeMessagesJSON contains the JSON metadata for the struct
+// [WidgetNewResponseEnvelopeMessages]
+type widgetNewResponseEnvelopeMessagesJSON struct {
+ Code apijson.Field
+ Message apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetNewResponseEnvelopeMessagesJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetNewResponseEnvelopeResultInfo struct {
+ // Total number of results for the requested service
+ Count float64 `json:"count,required"`
+ // Current page within paginated list of results
+ Page float64 `json:"page,required"`
+ // Number of results per page of results
+ PerPage float64 `json:"per_page,required"`
+ // Total results available without any search parameters
+ TotalCount float64 `json:"total_count,required"`
+ JSON widgetNewResponseEnvelopeResultInfoJSON `json:"-"`
+}
+
+// widgetNewResponseEnvelopeResultInfoJSON contains the JSON metadata for the
+// struct [WidgetNewResponseEnvelopeResultInfo]
+type widgetNewResponseEnvelopeResultInfoJSON struct {
+ Count apijson.Field
+ Page apijson.Field
+ PerPage apijson.Field
+ TotalCount apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetNewResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetNewResponseEnvelopeResultInfoJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetUpdateParams struct {
+ // Identifier
+ AccountID param.Field[string] `path:"account_id,required"`
+ Domains param.Field[[]string] `json:"domains,required"`
+ // Widget Mode
+ Mode param.Field[WidgetUpdateParamsMode] `json:"mode,required"`
+ // Human readable widget name. Not unique. Cloudflare suggests that you set this to
+ // a meaningful string to make it easier to identify your widget, and where it is
+ // used.
+ Name param.Field[string] `json:"name,required"`
+ // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive
+ // challenges in response to malicious bots (ENT only).
+ BotFightMode param.Field[bool] `json:"bot_fight_mode"`
+ // If Turnstile is embedded on a Cloudflare site and the widget should grant
+ // challenge clearance, this setting can determine the clearance level to be set
+ ClearanceLevel param.Field[WidgetUpdateParamsClearanceLevel] `json:"clearance_level"`
+ // Do not show any Cloudflare branding on the widget (ENT only).
+ Offlabel param.Field[bool] `json:"offlabel"`
+}
+
+func (r WidgetUpdateParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// Widget Mode
+type WidgetUpdateParamsMode string
+
+const (
+ WidgetUpdateParamsModeNonInteractive WidgetUpdateParamsMode = "non-interactive"
+ WidgetUpdateParamsModeInvisible WidgetUpdateParamsMode = "invisible"
+ WidgetUpdateParamsModeManaged WidgetUpdateParamsMode = "managed"
+)
+
+// If Turnstile is embedded on a Cloudflare site and the widget should grant
+// challenge clearance, this setting can determine the clearance level to be set
+type WidgetUpdateParamsClearanceLevel string
+
+const (
+ WidgetUpdateParamsClearanceLevelNoClearance WidgetUpdateParamsClearanceLevel = "no_clearance"
+ WidgetUpdateParamsClearanceLevelJschallenge WidgetUpdateParamsClearanceLevel = "jschallenge"
+ WidgetUpdateParamsClearanceLevelManaged WidgetUpdateParamsClearanceLevel = "managed"
+ WidgetUpdateParamsClearanceLevelInteractive WidgetUpdateParamsClearanceLevel = "interactive"
+)
+
+type WidgetUpdateResponseEnvelope struct {
+ Errors []WidgetUpdateResponseEnvelopeErrors `json:"errors,required"`
+ Messages []WidgetUpdateResponseEnvelopeMessages `json:"messages,required"`
+ // Whether the API call was successful
+ Success bool `json:"success,required"`
+ // A Turnstile widget's detailed configuration
+ Result NcChallengesAdminWidgetDetail `json:"result"`
+ JSON widgetUpdateResponseEnvelopeJSON `json:"-"`
+}
+
+// widgetUpdateResponseEnvelopeJSON contains the JSON metadata for the struct
+// [WidgetUpdateResponseEnvelope]
+type widgetUpdateResponseEnvelopeJSON struct {
+ Errors apijson.Field
+ Messages apijson.Field
+ Success apijson.Field
+ Result apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetUpdateResponseEnvelopeJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetUpdateResponseEnvelopeErrors struct {
+ Code int64 `json:"code,required"`
+ Message string `json:"message,required"`
+ JSON widgetUpdateResponseEnvelopeErrorsJSON `json:"-"`
+}
+
+// widgetUpdateResponseEnvelopeErrorsJSON contains the JSON metadata for the struct
+// [WidgetUpdateResponseEnvelopeErrors]
+type widgetUpdateResponseEnvelopeErrorsJSON struct {
+ Code apijson.Field
+ Message apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetUpdateResponseEnvelopeErrorsJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetUpdateResponseEnvelopeMessages struct {
+ Code int64 `json:"code,required"`
+ Message string `json:"message,required"`
+ JSON widgetUpdateResponseEnvelopeMessagesJSON `json:"-"`
+}
+
+// widgetUpdateResponseEnvelopeMessagesJSON contains the JSON metadata for the
+// struct [WidgetUpdateResponseEnvelopeMessages]
+type widgetUpdateResponseEnvelopeMessagesJSON struct {
+ Code apijson.Field
+ Message apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetUpdateResponseEnvelopeMessagesJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetListParams struct {
+ // Identifier
+ AccountID param.Field[string] `path:"account_id,required"`
+ // Direction to order widgets.
+ Direction param.Field[WidgetListParamsDirection] `query:"direction"`
+ // Field to order widgets by.
+ Order param.Field[WidgetListParamsOrder] `query:"order"`
+ // Page number of paginated results.
+ Page param.Field[float64] `query:"page"`
+ // Number of items per page.
+ PerPage param.Field[float64] `query:"per_page"`
+}
+
+// URLQuery serializes [WidgetListParams]'s query parameters as `url.Values`.
+func (r WidgetListParams) URLQuery() (v url.Values) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+// Direction to order widgets.
+type WidgetListParamsDirection string
+
+const (
+ WidgetListParamsDirectionAsc WidgetListParamsDirection = "asc"
+ WidgetListParamsDirectionDesc WidgetListParamsDirection = "desc"
+)
+
+// Field to order widgets by.
+type WidgetListParamsOrder string
+
+const (
+ WidgetListParamsOrderID WidgetListParamsOrder = "id"
+ WidgetListParamsOrderSitekey WidgetListParamsOrder = "sitekey"
+ WidgetListParamsOrderName WidgetListParamsOrder = "name"
+ WidgetListParamsOrderCreatedOn WidgetListParamsOrder = "created_on"
+ WidgetListParamsOrderModifiedOn WidgetListParamsOrder = "modified_on"
+)
+
+type WidgetDeleteParams struct {
+ // Identifier
+ AccountID param.Field[string] `path:"account_id,required"`
+}
+
+type WidgetDeleteResponseEnvelope struct {
+ Errors []WidgetDeleteResponseEnvelopeErrors `json:"errors,required"`
+ Messages []WidgetDeleteResponseEnvelopeMessages `json:"messages,required"`
+ // Whether the API call was successful
+ Success bool `json:"success,required"`
+ // A Turnstile widget's detailed configuration
+ Result NcChallengesAdminWidgetDetail `json:"result"`
+ JSON widgetDeleteResponseEnvelopeJSON `json:"-"`
+}
+
+// widgetDeleteResponseEnvelopeJSON contains the JSON metadata for the struct
+// [WidgetDeleteResponseEnvelope]
+type widgetDeleteResponseEnvelopeJSON struct {
+ Errors apijson.Field
+ Messages apijson.Field
+ Success apijson.Field
+ Result apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetDeleteResponseEnvelopeJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetDeleteResponseEnvelopeErrors struct {
+ Code int64 `json:"code,required"`
+ Message string `json:"message,required"`
+ JSON widgetDeleteResponseEnvelopeErrorsJSON `json:"-"`
+}
+
+// widgetDeleteResponseEnvelopeErrorsJSON contains the JSON metadata for the struct
+// [WidgetDeleteResponseEnvelopeErrors]
+type widgetDeleteResponseEnvelopeErrorsJSON struct {
+ Code apijson.Field
+ Message apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetDeleteResponseEnvelopeErrorsJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetDeleteResponseEnvelopeMessages struct {
+ Code int64 `json:"code,required"`
+ Message string `json:"message,required"`
+ JSON widgetDeleteResponseEnvelopeMessagesJSON `json:"-"`
+}
+
+// widgetDeleteResponseEnvelopeMessagesJSON contains the JSON metadata for the
+// struct [WidgetDeleteResponseEnvelopeMessages]
+type widgetDeleteResponseEnvelopeMessagesJSON struct {
+ Code apijson.Field
+ Message apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetDeleteResponseEnvelopeMessagesJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetGetParams struct {
+ // Identifier
+ AccountID param.Field[string] `path:"account_id,required"`
+}
+
+type WidgetGetResponseEnvelope struct {
+ Errors []WidgetGetResponseEnvelopeErrors `json:"errors,required"`
+ Messages []WidgetGetResponseEnvelopeMessages `json:"messages,required"`
+ // Whether the API call was successful
+ Success bool `json:"success,required"`
+ // A Turnstile widget's detailed configuration
+ Result NcChallengesAdminWidgetDetail `json:"result"`
+ JSON widgetGetResponseEnvelopeJSON `json:"-"`
+}
+
+// widgetGetResponseEnvelopeJSON contains the JSON metadata for the struct
+// [WidgetGetResponseEnvelope]
+type widgetGetResponseEnvelopeJSON struct {
+ Errors apijson.Field
+ Messages apijson.Field
+ Success apijson.Field
+ Result apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetGetResponseEnvelopeJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetGetResponseEnvelopeErrors struct {
+ Code int64 `json:"code,required"`
+ Message string `json:"message,required"`
+ JSON widgetGetResponseEnvelopeErrorsJSON `json:"-"`
+}
+
+// widgetGetResponseEnvelopeErrorsJSON contains the JSON metadata for the struct
+// [WidgetGetResponseEnvelopeErrors]
+type widgetGetResponseEnvelopeErrorsJSON struct {
+ Code apijson.Field
+ Message apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetGetResponseEnvelopeErrorsJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetGetResponseEnvelopeMessages struct {
+ Code int64 `json:"code,required"`
+ Message string `json:"message,required"`
+ JSON widgetGetResponseEnvelopeMessagesJSON `json:"-"`
+}
+
+// widgetGetResponseEnvelopeMessagesJSON contains the JSON metadata for the struct
+// [WidgetGetResponseEnvelopeMessages]
+type widgetGetResponseEnvelopeMessagesJSON struct {
+ Code apijson.Field
+ Message apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetGetResponseEnvelopeMessagesJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetRotateSecretParams struct {
+ // Identifier
+ AccountID param.Field[string] `path:"account_id,required"`
+ // If `invalidate_immediately` is set to `false`, the previous secret will remain
+ // valid for two hours. Otherwise, the secret is immediately invalidated, and
+ // requests using it will be rejected.
+ InvalidateImmediately param.Field[bool] `json:"invalidate_immediately"`
+}
+
+func (r WidgetRotateSecretParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type WidgetRotateSecretResponseEnvelope struct {
+ Errors []WidgetRotateSecretResponseEnvelopeErrors `json:"errors,required"`
+ Messages []WidgetRotateSecretResponseEnvelopeMessages `json:"messages,required"`
+ // Whether the API call was successful
+ Success bool `json:"success,required"`
+ // A Turnstile widget's detailed configuration
+ Result NcChallengesAdminWidgetDetail `json:"result"`
+ JSON widgetRotateSecretResponseEnvelopeJSON `json:"-"`
+}
+
+// widgetRotateSecretResponseEnvelopeJSON contains the JSON metadata for the struct
+// [WidgetRotateSecretResponseEnvelope]
+type widgetRotateSecretResponseEnvelopeJSON struct {
+ Errors apijson.Field
+ Messages apijson.Field
+ Success apijson.Field
+ Result apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetRotateSecretResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetRotateSecretResponseEnvelopeJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetRotateSecretResponseEnvelopeErrors struct {
+ Code int64 `json:"code,required"`
+ Message string `json:"message,required"`
+ JSON widgetRotateSecretResponseEnvelopeErrorsJSON `json:"-"`
+}
+
+// widgetRotateSecretResponseEnvelopeErrorsJSON contains the JSON metadata for the
+// struct [WidgetRotateSecretResponseEnvelopeErrors]
+type widgetRotateSecretResponseEnvelopeErrorsJSON struct {
+ Code apijson.Field
+ Message apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetRotateSecretResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetRotateSecretResponseEnvelopeErrorsJSON) RawJSON() string {
+ return r.raw
+}
+
+type WidgetRotateSecretResponseEnvelopeMessages struct {
+ Code int64 `json:"code,required"`
+ Message string `json:"message,required"`
+ JSON widgetRotateSecretResponseEnvelopeMessagesJSON `json:"-"`
+}
+
+// widgetRotateSecretResponseEnvelopeMessagesJSON contains the JSON metadata for
+// the struct [WidgetRotateSecretResponseEnvelopeMessages]
+type widgetRotateSecretResponseEnvelopeMessagesJSON struct {
+ Code apijson.Field
+ Message apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *WidgetRotateSecretResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r widgetRotateSecretResponseEnvelopeMessagesJSON) RawJSON() string {
+ return r.raw
+}
diff --git a/challenges/widget_test.go b/challenges/widget_test.go
new file mode 100644
index 00000000000..3eeab1e3be5
--- /dev/null
+++ b/challenges/widget_test.go
@@ -0,0 +1,209 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package challenges_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ "github.com/cloudflare/cloudflare-go/v2"
+ "github.com/cloudflare/cloudflare-go/v2/challenges"
+ "github.com/cloudflare/cloudflare-go/v2/internal/testutil"
+ "github.com/cloudflare/cloudflare-go/v2/option"
+)
+
+func TestWidgetNewWithOptionalParams(t *testing.T) {
+ t.Skip("skipped: tests are disabled for the time being")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := cloudflare.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
+ option.WithAPIEmail("user@example.com"),
+ )
+ _, err := client.Challenges.Widgets.New(context.TODO(), challenges.WidgetNewParams{
+ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
+ Domains: cloudflare.F([]string{"203.0.113.1", "cloudflare.com", "blog.example.com"}),
+ Mode: cloudflare.F(challenges.WidgetNewParamsModeInvisible),
+ Name: cloudflare.F("blog.cloudflare.com login form"),
+ Direction: cloudflare.F(challenges.WidgetNewParamsDirectionAsc),
+ Order: cloudflare.F(challenges.WidgetNewParamsOrderID),
+ Page: cloudflare.F(1.000000),
+ PerPage: cloudflare.F(5.000000),
+ BotFightMode: cloudflare.F(false),
+ ClearanceLevel: cloudflare.F(challenges.WidgetNewParamsClearanceLevelInteractive),
+ Offlabel: cloudflare.F(false),
+ Region: cloudflare.F(challenges.WidgetNewParamsRegionWorld),
+ })
+ if err != nil {
+ var apierr *cloudflare.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestWidgetUpdateWithOptionalParams(t *testing.T) {
+ t.Skip("skipped: tests are disabled for the time being")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := cloudflare.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
+ option.WithAPIEmail("user@example.com"),
+ )
+ _, err := client.Challenges.Widgets.Update(
+ context.TODO(),
+ "0x4AAF00AAAABn0R22HWm-YUc",
+ challenges.WidgetUpdateParams{
+ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
+ Domains: cloudflare.F([]string{"203.0.113.1", "cloudflare.com", "blog.example.com"}),
+ Mode: cloudflare.F(challenges.WidgetUpdateParamsModeInvisible),
+ Name: cloudflare.F("blog.cloudflare.com login form"),
+ BotFightMode: cloudflare.F(false),
+ ClearanceLevel: cloudflare.F(challenges.WidgetUpdateParamsClearanceLevelInteractive),
+ Offlabel: cloudflare.F(false),
+ },
+ )
+ if err != nil {
+ var apierr *cloudflare.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestWidgetListWithOptionalParams(t *testing.T) {
+ t.Skip("skipped: tests are disabled for the time being")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := cloudflare.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
+ option.WithAPIEmail("user@example.com"),
+ )
+ _, err := client.Challenges.Widgets.List(context.TODO(), challenges.WidgetListParams{
+ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
+ Direction: cloudflare.F(challenges.WidgetListParamsDirectionAsc),
+ Order: cloudflare.F(challenges.WidgetListParamsOrderID),
+ Page: cloudflare.F(1.000000),
+ PerPage: cloudflare.F(5.000000),
+ })
+ if err != nil {
+ var apierr *cloudflare.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestWidgetDelete(t *testing.T) {
+ t.Skip("skipped: tests are disabled for the time being")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := cloudflare.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
+ option.WithAPIEmail("user@example.com"),
+ )
+ _, err := client.Challenges.Widgets.Delete(
+ context.TODO(),
+ "0x4AAF00AAAABn0R22HWm-YUc",
+ challenges.WidgetDeleteParams{
+ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
+ },
+ )
+ if err != nil {
+ var apierr *cloudflare.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestWidgetGet(t *testing.T) {
+ t.Skip("skipped: tests are disabled for the time being")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := cloudflare.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
+ option.WithAPIEmail("user@example.com"),
+ )
+ _, err := client.Challenges.Widgets.Get(
+ context.TODO(),
+ "0x4AAF00AAAABn0R22HWm-YUc",
+ challenges.WidgetGetParams{
+ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
+ },
+ )
+ if err != nil {
+ var apierr *cloudflare.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestWidgetRotateSecretWithOptionalParams(t *testing.T) {
+ t.Skip("skipped: tests are disabled for the time being")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := cloudflare.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
+ option.WithAPIEmail("user@example.com"),
+ )
+ _, err := client.Challenges.Widgets.RotateSecret(
+ context.TODO(),
+ "0x4AAF00AAAABn0R22HWm-YUc",
+ challenges.WidgetRotateSecretParams{
+ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
+ InvalidateImmediately: cloudflare.F(true),
+ },
+ )
+ if err != nil {
+ var apierr *cloudflare.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/client_test.go b/client_test.go
index f541f197451..f1d4c0fe619 100644
--- a/client_test.go
+++ b/client_test.go
@@ -4,11 +4,13 @@ package cloudflare_test
import (
"context"
+ "fmt"
"net/http"
"testing"
"time"
"github.com/cloudflare/cloudflare-go/v2"
+ "github.com/cloudflare/cloudflare-go/v2/internal"
"github.com/cloudflare/cloudflare-go/v2/option"
"github.com/cloudflare/cloudflare-go/v2/zones"
)
@@ -21,6 +23,32 @@ func (t *closureTransport) RoundTrip(req *http.Request) (*http.Response, error)
return t.fn(req)
}
+func TestUserAgentHeader(t *testing.T) {
+ var userAgent string
+ client := cloudflare.NewClient(
+ option.WithHTTPClient(&http.Client{
+ Transport: &closureTransport{
+ fn: func(req *http.Request) (*http.Response, error) {
+ userAgent = req.Header.Get("User-Agent")
+ return &http.Response{
+ StatusCode: http.StatusOK,
+ }, nil
+ },
+ },
+ }),
+ )
+ client.Zones.New(context.Background(), zones.ZoneNewParams{
+ Account: cloudflare.F(zones.ZoneNewParamsAccount{
+ ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
+ }),
+ Name: cloudflare.F("example.com"),
+ Type: cloudflare.F(zones.ZoneNewParamsTypeFull),
+ })
+ if userAgent != fmt.Sprintf("Cloudflare/Go %s", internal.PackageVersion) {
+ t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent)
+ }
+}
+
func TestRetryAfter(t *testing.T) {
attempts := 0
client := cloudflare.NewClient(
diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go
index 7f5fc8730d1..f946609179e 100644
--- a/internal/requestconfig/requestconfig.go
+++ b/internal/requestconfig/requestconfig.go
@@ -23,6 +23,12 @@ import (
"github.com/cloudflare/cloudflare-go/v2/internal/apiquery"
)
+func getDefaultHeaders() map[string]string {
+ return map[string]string{
+ "User-Agent": fmt.Sprintf("Cloudflare/Go %s", internal.PackageVersion),
+ }
+}
+
func getNormalizedOS() string {
switch runtime.GOOS {
case "ios":
@@ -118,6 +124,9 @@ func NewRequestConfig(ctx context.Context, method string, u string, body interfa
}
req.Header.Set("Accept", "application/json")
+ for k, v := range getDefaultHeaders() {
+ req.Header.Add(k, v)
+ }
for k, v := range getPlatformProperties() {
req.Header.Add(k, v)
diff --git a/internal/shared/union.go b/internal/shared/union.go
index 4658bd3fb0c..a0bb599d279 100644
--- a/internal/shared/union.go
+++ b/internal/shared/union.go
@@ -159,9 +159,8 @@ func (UnionString) ImplementsAlertingV3ListResponse()
func (UnionString) ImplementsAlertingV3DestinationEligibleGetResponse() {}
func (UnionString) ImplementsAlertingV3DestinationPagerdutyDeleteResponse() {}
func (UnionString) ImplementsAlertingV3DestinationWebhookDeleteResponse() {}
-func (UnionString) ImplementsAlertingV3PolicyListResponseMechanismsID() {}
+func (UnionString) ImplementsAlertingAaaPoliciesMechanismsID() {}
func (UnionString) ImplementsAlertingV3PolicyDeleteResponse() {}
-func (UnionString) ImplementsAlertingV3PolicyGetResponseMechanismsID() {}
func (UnionString) ImplementsAlertingV3PolicyNewParamsMechanismsID() {}
func (UnionString) ImplementsAlertingV3PolicyUpdateParamsMechanismsID() {}
func (UnionString) ImplementsD1DatabaseDeleteResponse() {}
diff --git a/internal/version.go b/internal/version.go
index 9403a6ab84f..7fe73d69000 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "2.0.0-beta.4" // x-release-please-version
+const PackageVersion = "2.0.0-beta.5" // x-release-please-version
diff --git a/page_shield/script.go b/page_shield/script.go
index a39d9b2534d..8476145c167 100644
--- a/page_shield/script.go
+++ b/page_shield/script.go
@@ -56,6 +56,7 @@ func (r *ScriptService) Get(ctx context.Context, scriptID string, query ScriptGe
type PageShieldScript struct {
ID interface{} `json:"id"`
AddedAt interface{} `json:"added_at"`
+ DataflowScore interface{} `json:"dataflow_score"`
DomainReportedMalicious interface{} `json:"domain_reported_malicious"`
FetchedAt interface{} `json:"fetched_at"`
FirstPageURL interface{} `json:"first_page_url"`
@@ -64,6 +65,7 @@ type PageShieldScript struct {
Host interface{} `json:"host"`
JsIntegrityScore interface{} `json:"js_integrity_score"`
LastSeenAt interface{} `json:"last_seen_at"`
+ ObfuscationScore interface{} `json:"obfuscation_score"`
PageURLs interface{} `json:"page_urls"`
URL interface{} `json:"url"`
URLContainsCdnCgiPath interface{} `json:"url_contains_cdn_cgi_path"`
@@ -75,6 +77,7 @@ type PageShieldScript struct {
type pageShieldScriptJSON struct {
ID apijson.Field
AddedAt apijson.Field
+ DataflowScore apijson.Field
DomainReportedMalicious apijson.Field
FetchedAt apijson.Field
FirstPageURL apijson.Field
@@ -83,6 +86,7 @@ type pageShieldScriptJSON struct {
Host apijson.Field
JsIntegrityScore apijson.Field
LastSeenAt apijson.Field
+ ObfuscationScore apijson.Field
PageURLs apijson.Field
URL apijson.Field
URLContainsCdnCgiPath apijson.Field
@@ -101,6 +105,7 @@ func (r pageShieldScriptJSON) RawJSON() string {
type ScriptGetResponse struct {
ID interface{} `json:"id"`
AddedAt interface{} `json:"added_at"`
+ DataflowScore interface{} `json:"dataflow_score"`
DomainReportedMalicious interface{} `json:"domain_reported_malicious"`
FetchedAt interface{} `json:"fetched_at"`
FirstPageURL interface{} `json:"first_page_url"`
@@ -109,6 +114,7 @@ type ScriptGetResponse struct {
Host interface{} `json:"host"`
JsIntegrityScore interface{} `json:"js_integrity_score"`
LastSeenAt interface{} `json:"last_seen_at"`
+ ObfuscationScore interface{} `json:"obfuscation_score"`
PageURLs interface{} `json:"page_urls"`
URL interface{} `json:"url"`
URLContainsCdnCgiPath interface{} `json:"url_contains_cdn_cgi_path"`
@@ -121,6 +127,7 @@ type ScriptGetResponse struct {
type scriptGetResponseJSON struct {
ID apijson.Field
AddedAt apijson.Field
+ DataflowScore apijson.Field
DomainReportedMalicious apijson.Field
FetchedAt apijson.Field
FirstPageURL apijson.Field
@@ -129,6 +136,7 @@ type scriptGetResponseJSON struct {
Host apijson.Field
JsIntegrityScore apijson.Field
LastSeenAt apijson.Field
+ ObfuscationScore apijson.Field
PageURLs apijson.Field
URL apijson.Field
URLContainsCdnCgiPath apijson.Field
@@ -147,21 +155,27 @@ func (r scriptGetResponseJSON) RawJSON() string {
// The version of the analyzed script.
type ScriptGetResponseVersion struct {
+ // The dataflow score of the JavaScript content.
+ DataflowScore int64 `json:"dataflow_score,nullable"`
// The timestamp of when the script was last fetched.
FetchedAt string `json:"fetched_at,nullable"`
// The computed hash of the analyzed script.
Hash string `json:"hash,nullable"`
// The integrity score of the JavaScript content.
- JsIntegrityScore int64 `json:"js_integrity_score,nullable"`
+ JsIntegrityScore int64 `json:"js_integrity_score,nullable"`
+ // The obfuscation score of the JavaScript content.
+ ObfuscationScore int64 `json:"obfuscation_score,nullable"`
JSON scriptGetResponseVersionJSON `json:"-"`
}
// scriptGetResponseVersionJSON contains the JSON metadata for the struct
// [ScriptGetResponseVersion]
type scriptGetResponseVersionJSON struct {
+ DataflowScore apijson.Field
FetchedAt apijson.Field
Hash apijson.Field
JsIntegrityScore apijson.Field
+ ObfuscationScore apijson.Field
raw string
ExtraFields map[string]apijson.Field
}