Documentation
¶
Index ¶
- Constants
- type ASN
- type ASNParam
- type Action
- type AuditLog
- type AuditLogAction
- type AuditLogActor
- type AuditLogActorType
- type AuditLogOwner
- type AuditLogResource
- type CertificateCA
- type CertificateRequestType
- type CloudflareTunnel
- type CloudflareTunnelConnection
- type CloudflareTunnelStatus
- type CloudflareTunnelTunType
- type Error
- type ErrorData
- type MemberParam
- type MemberRoleParam
- type MemberRolesPermissionsParam
- type MemberStatus
- type MemberUserParam
- type Methods
- type Permission
- type PermissionGrant
- type PermissionGrantParam
- type RateLimit
- type RateLimitAction
- type RateLimitActionMode
- type RateLimitActionResponse
- type RateLimitBypass
- type RateLimitBypassName
- type RateLimitDeleteResponse
- type RateLimitDeleteResponseEnvelope
- type RateLimitDeleteResponseEnvelopeSuccess
- type RateLimitEditParams
- type RateLimitEditParamsAction
- type RateLimitEditParamsActionMode
- type RateLimitEditParamsActionResponse
- type RateLimitEditParamsMatch
- type RateLimitEditParamsMatchHeader
- type RateLimitEditParamsMatchHeadersOp
- type RateLimitEditParamsMatchRequest
- type RateLimitEditParamsMatchResponse
- type RateLimitEditResponseEnvelope
- type RateLimitEditResponseEnvelopeSuccess
- type RateLimitGetResponseEnvelope
- type RateLimitGetResponseEnvelopeSuccess
- type RateLimitListParams
- type RateLimitMatch
- type RateLimitMatchHeader
- type RateLimitMatchHeadersOp
- type RateLimitMatchRequest
- type RateLimitMatchResponse
- type RateLimitNewParams
- type RateLimitNewParamsAction
- type RateLimitNewParamsActionMode
- type RateLimitNewParamsActionResponse
- type RateLimitNewParamsMatch
- type RateLimitNewParamsMatchHeader
- type RateLimitNewParamsMatchHeadersOp
- type RateLimitNewParamsMatchRequest
- type RateLimitNewParamsMatchResponse
- type RateLimitNewResponseEnvelope
- type RateLimitNewResponseEnvelopeSuccess
- type RateLimitService
- func (r *RateLimitService) Delete(ctx context.Context, zoneIdentifier string, id string, ...) (res *RateLimitDeleteResponse, err error)deprecated
- func (r *RateLimitService) Edit(ctx context.Context, zoneIdentifier string, id string, ...) (res *interface{}, err error)deprecated
- func (r *RateLimitService) Get(ctx context.Context, zoneIdentifier string, id string, ...) (res *interface{}, err error)deprecated
- func (r *RateLimitService) List(ctx context.Context, zoneIdentifier string, query RateLimitListParams, ...) (res *pagination.V4PagePaginationArray[RateLimit], err error)deprecated
- func (r *RateLimitService) ListAutoPaging(ctx context.Context, zoneIdentifier string, query RateLimitListParams, ...) *pagination.V4PagePaginationArrayAutoPager[RateLimit]deprecated
- func (r *RateLimitService) New(ctx context.Context, zoneIdentifier string, body RateLimitNewParams, ...) (res *interface{}, err error)deprecated
- type RatePlan
- type RatePlanParam
- type ResponseInfo
- type Role
- type SortDirection
- type Subscription
- type SubscriptionFrequency
- type SubscriptionParam
- type SubscriptionState
Constants ¶
const AuditLogActorTypeAdmin = shared.AuditLogActorTypeAdmin
This is an alias to an internal value.
const AuditLogActorTypeCloudflare = shared.AuditLogActorTypeCloudflare
This is an alias to an internal value.
const AuditLogActorTypeUser = shared.AuditLogActorTypeUser
This is an alias to an internal value.
const CertificateCADigicert = shared.CertificateCADigicert
This is an alias to an internal value.
const CertificateCAGoogle = shared.CertificateCAGoogle
This is an alias to an internal value.
const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt
This is an alias to an internal value.
const CertificateCASSLCom = shared.CertificateCASSLCom
This is an alias to an internal value.
const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate
This is an alias to an internal value.
const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC
This is an alias to an internal value.
const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA
This is an alias to an internal value.
const CloudflareTunnelStatusDegraded = shared.CloudflareTunnelStatusDegraded
This is an alias to an internal value.
const CloudflareTunnelStatusDown = shared.CloudflareTunnelStatusDown
This is an alias to an internal value.
const CloudflareTunnelStatusHealthy = shared.CloudflareTunnelStatusHealthy
This is an alias to an internal value.
const CloudflareTunnelStatusInactive = shared.CloudflareTunnelStatusInactive
This is an alias to an internal value.
const CloudflareTunnelTunTypeCNI = shared.CloudflareTunnelTunTypeCNI
This is an alias to an internal value.
const CloudflareTunnelTunTypeCfdTunnel = shared.CloudflareTunnelTunTypeCfdTunnel
This is an alias to an internal value.
const CloudflareTunnelTunTypeGRE = shared.CloudflareTunnelTunTypeGRE
This is an alias to an internal value.
const CloudflareTunnelTunTypeIPSec = shared.CloudflareTunnelTunTypeIPSec
This is an alias to an internal value.
const CloudflareTunnelTunTypeWARPConnector = shared.CloudflareTunnelTunTypeWARPConnector
This is an alias to an internal value.
const MemberStatusAccepted = shared.MemberStatusAccepted
This is an alias to an internal value.
const MemberStatusPending = shared.MemberStatusPending
This is an alias to an internal value.
const SortDirectionAsc = shared.SortDirectionAsc
This is an alias to an internal value.
const SortDirectionDesc = shared.SortDirectionDesc
This is an alias to an internal value.
const SubscriptionFrequencyMonthly = shared.SubscriptionFrequencyMonthly
This is an alias to an internal value.
const SubscriptionFrequencyQuarterly = shared.SubscriptionFrequencyQuarterly
This is an alias to an internal value.
const SubscriptionFrequencyWeekly = shared.SubscriptionFrequencyWeekly
This is an alias to an internal value.
const SubscriptionFrequencyYearly = shared.SubscriptionFrequencyYearly
This is an alias to an internal value.
const SubscriptionStateAwaitingPayment = shared.SubscriptionStateAwaitingPayment
This is an alias to an internal value.
const SubscriptionStateCancelled = shared.SubscriptionStateCancelled
This is an alias to an internal value.
const SubscriptionStateExpired = shared.SubscriptionStateExpired
This is an alias to an internal value.
const SubscriptionStateFailed = shared.SubscriptionStateFailed
This is an alias to an internal value.
const SubscriptionStatePaid = shared.SubscriptionStatePaid
This is an alias to an internal value.
const SubscriptionStateProvisioned = shared.SubscriptionStateProvisioned
This is an alias to an internal value.
const SubscriptionStateTrial = shared.SubscriptionStateTrial
This is an alias to an internal value.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action string
The action to apply to a matched request. The `log` action is only available on an Enterprise plan.
type AuditLogAction ¶
type AuditLogAction = shared.AuditLogAction
This is an alias to an internal type.
type AuditLogActor ¶
type AuditLogActor = shared.AuditLogActor
This is an alias to an internal type.
type AuditLogActorType ¶
type AuditLogActorType = shared.AuditLogActorType
The type of actor, whether a User, Cloudflare Admin, or an Automated System.
This is an alias to an internal type.
type AuditLogOwner ¶
type AuditLogOwner = shared.AuditLogOwner
This is an alias to an internal type.
type AuditLogResource ¶
type AuditLogResource = shared.AuditLogResource
This is an alias to an internal type.
type CertificateCA ¶
type CertificateCA = shared.CertificateCA
The Certificate Authority that will issue the certificate
This is an alias to an internal type.
type CertificateRequestType ¶
type CertificateRequestType = shared.CertificateRequestType
Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), or "keyless-certificate" (for Keyless SSL servers).
This is an alias to an internal type.
type CloudflareTunnel ¶
type CloudflareTunnel = shared.CloudflareTunnel
A Cloudflare Tunnel that connects your origin to Cloudflare's edge.
This is an alias to an internal type.
type CloudflareTunnelConnection ¶
type CloudflareTunnelConnection = shared.CloudflareTunnelConnection
This is an alias to an internal type.
type CloudflareTunnelStatus ¶
type CloudflareTunnelStatus = shared.CloudflareTunnelStatus
The status of the tunnel. Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy state), `healthy` (tunnel is active and able to serve traffic), or `down` (tunnel can not serve traffic as it has no connections to the Cloudflare Edge).
This is an alias to an internal type.
type CloudflareTunnelTunType ¶
type CloudflareTunnelTunType = shared.CloudflareTunnelTunType
The type of tunnel.
This is an alias to an internal type.
type MemberRoleParam ¶
type MemberRoleParam = shared.MemberRoleParam
This is an alias to an internal type.
type MemberRolesPermissionsParam ¶
type MemberRolesPermissionsParam = shared.MemberRolesPermissionsParam
This is an alias to an internal type.
type MemberStatus ¶
type MemberStatus = shared.MemberStatus
A member's status in the account.
This is an alias to an internal type.
type MemberUserParam ¶
type MemberUserParam = shared.MemberUserParam
Details of the user associated to the membership.
This is an alias to an internal type.
type PermissionGrant ¶
type PermissionGrant = shared.PermissionGrant
This is an alias to an internal type.
type PermissionGrantParam ¶
type PermissionGrantParam = shared.PermissionGrantParam
This is an alias to an internal type.
type RateLimit ¶
type RateLimit struct {
// The unique identifier of the rate limit.
ID string `json:"id"`
// The action to perform when the threshold of matched traffic within the
// configured period is exceeded.
Action RateLimitAction `json:"action"`
// Criteria specifying when the current rate limit should be bypassed. You can
// specify that the rate limit should not apply to one or more URLs.
Bypass []RateLimitBypass `json:"bypass"`
// An informative summary of the rate limit. This value is sanitized and any tags
// will be removed.
Description string `json:"description"`
// When true, indicates that the rate limit is currently disabled.
Disabled bool `json:"disabled"`
// Determines which traffic the rate limit counts towards the threshold.
Match RateLimitMatch `json:"match"`
// The time in seconds (an integer value) to count matching traffic. If the count
// exceeds the configured threshold within this period, Cloudflare will perform the
// configured action.
Period float64 `json:"period"`
// The threshold that will trigger the configured mitigation action. Configure this
// value along with the `period` property to establish a threshold per period.
Threshold float64 `json:"threshold"`
JSON rateLimitJSON `json:"-"`
}
func (*RateLimit) UnmarshalJSON ¶
type RateLimitAction ¶
type RateLimitAction struct {
// The action to perform.
Mode RateLimitActionMode `json:"mode"`
// A custom content type and reponse to return when the threshold is exceeded. The
// custom response configured in this object will override the custom error for the
// zone. This object is optional. Notes: If you omit this object, Cloudflare will
// use the default HTML error page. If "mode" is "challenge", "managed_challenge",
// or "js_challenge", Cloudflare will use the zone challenge pages and you should
// not provide the "response" object.
Response RateLimitActionResponse `json:"response"`
// The time in seconds during which Cloudflare will perform the mitigation action.
// Must be an integer value greater than or equal to the period. Notes: If "mode"
// is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the
// zone's Challenge Passage time and you should not provide this value.
Timeout float64 `json:"timeout"`
JSON rateLimitActionJSON `json:"-"`
}
The action to perform when the threshold of matched traffic within the configured period is exceeded.
func (*RateLimitAction) UnmarshalJSON ¶
func (r *RateLimitAction) UnmarshalJSON(data []byte) (err error)
type RateLimitActionMode ¶
type RateLimitActionMode string
The action to perform.
const ( RateLimitActionModeSimulate RateLimitActionMode = "simulate" RateLimitActionModeBan RateLimitActionMode = "ban" RateLimitActionModeChallenge RateLimitActionMode = "challenge" RateLimitActionModeJSChallenge RateLimitActionMode = "js_challenge" RateLimitActionModeManagedChallenge RateLimitActionMode = "managed_challenge" )
func (RateLimitActionMode) IsKnown ¶
func (r RateLimitActionMode) IsKnown() bool
type RateLimitActionResponse ¶
type RateLimitActionResponse struct {
// The response body to return. The value must conform to the configured content
// type.
Body string `json:"body"`
// The content type of the body. Must be one of the following: `text/plain`,
// `text/xml`, or `application/json`.
ContentType string `json:"content_type"`
JSON rateLimitActionResponseJSON `json:"-"`
}
A custom content type and reponse to return when the threshold is exceeded. The custom response configured in this object will override the custom error for the zone. This object is optional. Notes: If you omit this object, Cloudflare will use the default HTML error page. If "mode" is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the zone challenge pages and you should not provide the "response" object.
func (*RateLimitActionResponse) UnmarshalJSON ¶
func (r *RateLimitActionResponse) UnmarshalJSON(data []byte) (err error)
type RateLimitBypass ¶
type RateLimitBypass struct {
Name RateLimitBypassName `json:"name"`
// The URL to bypass.
Value string `json:"value"`
JSON rateLimitBypassJSON `json:"-"`
}
func (*RateLimitBypass) UnmarshalJSON ¶
func (r *RateLimitBypass) UnmarshalJSON(data []byte) (err error)
type RateLimitBypassName ¶
type RateLimitBypassName string
const (
RateLimitBypassNameURL RateLimitBypassName = "url"
)
func (RateLimitBypassName) IsKnown ¶
func (r RateLimitBypassName) IsKnown() bool
type RateLimitDeleteResponse ¶
type RateLimitDeleteResponse struct {
// The unique identifier of the rate limit.
ID string `json:"id"`
JSON rateLimitDeleteResponseJSON `json:"-"`
}
func (*RateLimitDeleteResponse) UnmarshalJSON ¶
func (r *RateLimitDeleteResponse) UnmarshalJSON(data []byte) (err error)
type RateLimitDeleteResponseEnvelope ¶
type RateLimitDeleteResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result RateLimitDeleteResponse `json:"result,required"`
// Whether the API call was successful
Success RateLimitDeleteResponseEnvelopeSuccess `json:"success,required"`
JSON rateLimitDeleteResponseEnvelopeJSON `json:"-"`
}
func (*RateLimitDeleteResponseEnvelope) UnmarshalJSON ¶
func (r *RateLimitDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type RateLimitDeleteResponseEnvelopeSuccess ¶
type RateLimitDeleteResponseEnvelopeSuccess bool
Whether the API call was successful
const (
RateLimitDeleteResponseEnvelopeSuccessTrue RateLimitDeleteResponseEnvelopeSuccess = true
)
func (RateLimitDeleteResponseEnvelopeSuccess) IsKnown ¶
func (r RateLimitDeleteResponseEnvelopeSuccess) IsKnown() bool
type RateLimitEditParams ¶
type RateLimitEditParams struct {
// The action to perform when the threshold of matched traffic within the
// configured period is exceeded.
Action param.Field[RateLimitEditParamsAction] `json:"action,required"`
// Determines which traffic the rate limit counts towards the threshold.
Match param.Field[RateLimitEditParamsMatch] `json:"match,required"`
// The time in seconds (an integer value) to count matching traffic. If the count
// exceeds the configured threshold within this period, Cloudflare will perform the
// configured action.
Period param.Field[float64] `json:"period,required"`
// The threshold that will trigger the configured mitigation action. Configure this
// value along with the `period` property to establish a threshold per period.
Threshold param.Field[float64] `json:"threshold,required"`
}
func (RateLimitEditParams) MarshalJSON ¶
func (r RateLimitEditParams) MarshalJSON() (data []byte, err error)
type RateLimitEditParamsAction ¶
type RateLimitEditParamsAction struct {
// The action to perform.
Mode param.Field[RateLimitEditParamsActionMode] `json:"mode"`
// A custom content type and reponse to return when the threshold is exceeded. The
// custom response configured in this object will override the custom error for the
// zone. This object is optional. Notes: If you omit this object, Cloudflare will
// use the default HTML error page. If "mode" is "challenge", "managed_challenge",
// or "js_challenge", Cloudflare will use the zone challenge pages and you should
// not provide the "response" object.
Response param.Field[RateLimitEditParamsActionResponse] `json:"response"`
// The time in seconds during which Cloudflare will perform the mitigation action.
// Must be an integer value greater than or equal to the period. Notes: If "mode"
// is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the
// zone's Challenge Passage time and you should not provide this value.
Timeout param.Field[float64] `json:"timeout"`
}
The action to perform when the threshold of matched traffic within the configured period is exceeded.
func (RateLimitEditParamsAction) MarshalJSON ¶
func (r RateLimitEditParamsAction) MarshalJSON() (data []byte, err error)
type RateLimitEditParamsActionMode ¶
type RateLimitEditParamsActionMode string
The action to perform.
const ( RateLimitEditParamsActionModeSimulate RateLimitEditParamsActionMode = "simulate" RateLimitEditParamsActionModeBan RateLimitEditParamsActionMode = "ban" RateLimitEditParamsActionModeChallenge RateLimitEditParamsActionMode = "challenge" RateLimitEditParamsActionModeJSChallenge RateLimitEditParamsActionMode = "js_challenge" RateLimitEditParamsActionModeManagedChallenge RateLimitEditParamsActionMode = "managed_challenge" )
func (RateLimitEditParamsActionMode) IsKnown ¶
func (r RateLimitEditParamsActionMode) IsKnown() bool
type RateLimitEditParamsActionResponse ¶
type RateLimitEditParamsActionResponse struct {
// The response body to return. The value must conform to the configured content
// type.
Body param.Field[string] `json:"body"`
// The content type of the body. Must be one of the following: `text/plain`,
// `text/xml`, or `application/json`.
ContentType param.Field[string] `json:"content_type"`
}
A custom content type and reponse to return when the threshold is exceeded. The custom response configured in this object will override the custom error for the zone. This object is optional. Notes: If you omit this object, Cloudflare will use the default HTML error page. If "mode" is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the zone challenge pages and you should not provide the "response" object.
func (RateLimitEditParamsActionResponse) MarshalJSON ¶
func (r RateLimitEditParamsActionResponse) MarshalJSON() (data []byte, err error)
type RateLimitEditParamsMatch ¶
type RateLimitEditParamsMatch struct {
Headers param.Field[[]RateLimitEditParamsMatchHeader] `json:"headers"`
Request param.Field[RateLimitEditParamsMatchRequest] `json:"request"`
Response param.Field[RateLimitEditParamsMatchResponse] `json:"response"`
}
Determines which traffic the rate limit counts towards the threshold.
func (RateLimitEditParamsMatch) MarshalJSON ¶
func (r RateLimitEditParamsMatch) MarshalJSON() (data []byte, err error)
type RateLimitEditParamsMatchHeader ¶
type RateLimitEditParamsMatchHeader struct {
// The name of the response header to match.
Name param.Field[string] `json:"name"`
// The operator used when matching: `eq` means "equal" and `ne` means "not equal".
Op param.Field[RateLimitEditParamsMatchHeadersOp] `json:"op"`
// The value of the response header, which must match exactly.
Value param.Field[string] `json:"value"`
}
func (RateLimitEditParamsMatchHeader) MarshalJSON ¶
func (r RateLimitEditParamsMatchHeader) MarshalJSON() (data []byte, err error)
type RateLimitEditParamsMatchHeadersOp ¶
type RateLimitEditParamsMatchHeadersOp string
The operator used when matching: `eq` means "equal" and `ne` means "not equal".
const ( RateLimitEditParamsMatchHeadersOpEq RateLimitEditParamsMatchHeadersOp = "eq" RateLimitEditParamsMatchHeadersOpNe RateLimitEditParamsMatchHeadersOp = "ne" )
func (RateLimitEditParamsMatchHeadersOp) IsKnown ¶
func (r RateLimitEditParamsMatchHeadersOp) IsKnown() bool
type RateLimitEditParamsMatchRequest ¶
type RateLimitEditParamsMatchRequest struct {
// The HTTP methods to match. You can specify a subset (for example,
// `['POST','PUT']`) or all methods (`['_ALL_']`). This field is optional when
// creating a rate limit.
Methods param.Field[[]Methods] `json:"methods"`
// The HTTP schemes to match. You can specify one scheme (`['HTTPS']`), both
// schemes (`['HTTP','HTTPS']`), or all schemes (`['_ALL_']`). This field is
// optional.
Schemes param.Field[[]string] `json:"schemes"`
// The URL pattern to match, composed of a host and a path such as
// `example.org/path*`. Normalization is applied before the pattern is matched. `*`
// wildcards are expanded to match applicable traffic. Query strings are not
// matched. Set the value to `*` to match all traffic to your zone.
URL param.Field[string] `json:"url"`
}
func (RateLimitEditParamsMatchRequest) MarshalJSON ¶
func (r RateLimitEditParamsMatchRequest) MarshalJSON() (data []byte, err error)
type RateLimitEditParamsMatchResponse ¶
type RateLimitEditParamsMatchResponse struct {
// When true, only the uncached traffic served from your origin servers will count
// towards rate limiting. In this case, any cached traffic served by Cloudflare
// will not count towards rate limiting. This field is optional. Notes: This field
// is deprecated. Instead, use response headers and set "origin_traffic" to "false"
// to avoid legacy behaviour interacting with the "response_headers" property.
OriginTraffic param.Field[bool] `json:"origin_traffic"`
}
func (RateLimitEditParamsMatchResponse) MarshalJSON ¶
func (r RateLimitEditParamsMatchResponse) MarshalJSON() (data []byte, err error)
type RateLimitEditResponseEnvelope ¶
type RateLimitEditResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result interface{} `json:"result,required"`
// Whether the API call was successful
Success RateLimitEditResponseEnvelopeSuccess `json:"success,required"`
JSON rateLimitEditResponseEnvelopeJSON `json:"-"`
}
func (*RateLimitEditResponseEnvelope) UnmarshalJSON ¶
func (r *RateLimitEditResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type RateLimitEditResponseEnvelopeSuccess ¶
type RateLimitEditResponseEnvelopeSuccess bool
Whether the API call was successful
const (
RateLimitEditResponseEnvelopeSuccessTrue RateLimitEditResponseEnvelopeSuccess = true
)
func (RateLimitEditResponseEnvelopeSuccess) IsKnown ¶
func (r RateLimitEditResponseEnvelopeSuccess) IsKnown() bool
type RateLimitGetResponseEnvelope ¶
type RateLimitGetResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result interface{} `json:"result,required"`
// Whether the API call was successful
Success RateLimitGetResponseEnvelopeSuccess `json:"success,required"`
JSON rateLimitGetResponseEnvelopeJSON `json:"-"`
}
func (*RateLimitGetResponseEnvelope) UnmarshalJSON ¶
func (r *RateLimitGetResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type RateLimitGetResponseEnvelopeSuccess ¶
type RateLimitGetResponseEnvelopeSuccess bool
Whether the API call was successful
const (
RateLimitGetResponseEnvelopeSuccessTrue RateLimitGetResponseEnvelopeSuccess = true
)
func (RateLimitGetResponseEnvelopeSuccess) IsKnown ¶
func (r RateLimitGetResponseEnvelopeSuccess) IsKnown() bool
type RateLimitListParams ¶
type RateLimitListParams struct {
// The page number of paginated results.
Page param.Field[float64] `query:"page"`
// The maximum number of results per page. You can only set the value to `1` or to
// a multiple of 5 such as `5`, `10`, `15`, or `20`.
PerPage param.Field[float64] `query:"per_page"`
}
func (RateLimitListParams) URLQuery ¶
func (r RateLimitListParams) URLQuery() (v url.Values)
URLQuery serializes RateLimitListParams's query parameters as `url.Values`.
type RateLimitMatch ¶
type RateLimitMatch struct {
Headers []RateLimitMatchHeader `json:"headers"`
Request RateLimitMatchRequest `json:"request"`
Response RateLimitMatchResponse `json:"response"`
JSON rateLimitMatchJSON `json:"-"`
}
Determines which traffic the rate limit counts towards the threshold.
func (*RateLimitMatch) UnmarshalJSON ¶
func (r *RateLimitMatch) UnmarshalJSON(data []byte) (err error)
type RateLimitMatchHeader ¶
type RateLimitMatchHeader struct {
// The name of the response header to match.
Name string `json:"name"`
// The operator used when matching: `eq` means "equal" and `ne` means "not equal".
Op RateLimitMatchHeadersOp `json:"op"`
// The value of the response header, which must match exactly.
Value string `json:"value"`
JSON rateLimitMatchHeaderJSON `json:"-"`
}
func (*RateLimitMatchHeader) UnmarshalJSON ¶
func (r *RateLimitMatchHeader) UnmarshalJSON(data []byte) (err error)
type RateLimitMatchHeadersOp ¶
type RateLimitMatchHeadersOp string
The operator used when matching: `eq` means "equal" and `ne` means "not equal".
const ( RateLimitMatchHeadersOpEq RateLimitMatchHeadersOp = "eq" RateLimitMatchHeadersOpNe RateLimitMatchHeadersOp = "ne" )
func (RateLimitMatchHeadersOp) IsKnown ¶
func (r RateLimitMatchHeadersOp) IsKnown() bool
type RateLimitMatchRequest ¶
type RateLimitMatchRequest struct {
// The HTTP methods to match. You can specify a subset (for example,
// `['POST','PUT']`) or all methods (`['_ALL_']`). This field is optional when
// creating a rate limit.
Methods []Methods `json:"methods"`
// The HTTP schemes to match. You can specify one scheme (`['HTTPS']`), both
// schemes (`['HTTP','HTTPS']`), or all schemes (`['_ALL_']`). This field is
// optional.
Schemes []string `json:"schemes"`
// The URL pattern to match, composed of a host and a path such as
// `example.org/path*`. Normalization is applied before the pattern is matched. `*`
// wildcards are expanded to match applicable traffic. Query strings are not
// matched. Set the value to `*` to match all traffic to your zone.
URL string `json:"url"`
JSON rateLimitMatchRequestJSON `json:"-"`
}
func (*RateLimitMatchRequest) UnmarshalJSON ¶
func (r *RateLimitMatchRequest) UnmarshalJSON(data []byte) (err error)
type RateLimitMatchResponse ¶
type RateLimitMatchResponse struct {
// When true, only the uncached traffic served from your origin servers will count
// towards rate limiting. In this case, any cached traffic served by Cloudflare
// will not count towards rate limiting. This field is optional. Notes: This field
// is deprecated. Instead, use response headers and set "origin_traffic" to "false"
// to avoid legacy behaviour interacting with the "response_headers" property.
OriginTraffic bool `json:"origin_traffic"`
JSON rateLimitMatchResponseJSON `json:"-"`
}
func (*RateLimitMatchResponse) UnmarshalJSON ¶
func (r *RateLimitMatchResponse) UnmarshalJSON(data []byte) (err error)
type RateLimitNewParams ¶
type RateLimitNewParams struct {
// The action to perform when the threshold of matched traffic within the
// configured period is exceeded.
Action param.Field[RateLimitNewParamsAction] `json:"action,required"`
// Determines which traffic the rate limit counts towards the threshold.
Match param.Field[RateLimitNewParamsMatch] `json:"match,required"`
// The time in seconds (an integer value) to count matching traffic. If the count
// exceeds the configured threshold within this period, Cloudflare will perform the
// configured action.
Period param.Field[float64] `json:"period,required"`
// The threshold that will trigger the configured mitigation action. Configure this
// value along with the `period` property to establish a threshold per period.
Threshold param.Field[float64] `json:"threshold,required"`
}
func (RateLimitNewParams) MarshalJSON ¶
func (r RateLimitNewParams) MarshalJSON() (data []byte, err error)
type RateLimitNewParamsAction ¶
type RateLimitNewParamsAction struct {
// The action to perform.
Mode param.Field[RateLimitNewParamsActionMode] `json:"mode"`
// A custom content type and reponse to return when the threshold is exceeded. The
// custom response configured in this object will override the custom error for the
// zone. This object is optional. Notes: If you omit this object, Cloudflare will
// use the default HTML error page. If "mode" is "challenge", "managed_challenge",
// or "js_challenge", Cloudflare will use the zone challenge pages and you should
// not provide the "response" object.
Response param.Field[RateLimitNewParamsActionResponse] `json:"response"`
// The time in seconds during which Cloudflare will perform the mitigation action.
// Must be an integer value greater than or equal to the period. Notes: If "mode"
// is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the
// zone's Challenge Passage time and you should not provide this value.
Timeout param.Field[float64] `json:"timeout"`
}
The action to perform when the threshold of matched traffic within the configured period is exceeded.
func (RateLimitNewParamsAction) MarshalJSON ¶
func (r RateLimitNewParamsAction) MarshalJSON() (data []byte, err error)
type RateLimitNewParamsActionMode ¶
type RateLimitNewParamsActionMode string
The action to perform.
const ( RateLimitNewParamsActionModeSimulate RateLimitNewParamsActionMode = "simulate" RateLimitNewParamsActionModeBan RateLimitNewParamsActionMode = "ban" RateLimitNewParamsActionModeChallenge RateLimitNewParamsActionMode = "challenge" RateLimitNewParamsActionModeJSChallenge RateLimitNewParamsActionMode = "js_challenge" RateLimitNewParamsActionModeManagedChallenge RateLimitNewParamsActionMode = "managed_challenge" )
func (RateLimitNewParamsActionMode) IsKnown ¶
func (r RateLimitNewParamsActionMode) IsKnown() bool
type RateLimitNewParamsActionResponse ¶
type RateLimitNewParamsActionResponse struct {
// The response body to return. The value must conform to the configured content
// type.
Body param.Field[string] `json:"body"`
// The content type of the body. Must be one of the following: `text/plain`,
// `text/xml`, or `application/json`.
ContentType param.Field[string] `json:"content_type"`
}
A custom content type and reponse to return when the threshold is exceeded. The custom response configured in this object will override the custom error for the zone. This object is optional. Notes: If you omit this object, Cloudflare will use the default HTML error page. If "mode" is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the zone challenge pages and you should not provide the "response" object.
func (RateLimitNewParamsActionResponse) MarshalJSON ¶
func (r RateLimitNewParamsActionResponse) MarshalJSON() (data []byte, err error)
type RateLimitNewParamsMatch ¶
type RateLimitNewParamsMatch struct {
Headers param.Field[[]RateLimitNewParamsMatchHeader] `json:"headers"`
Request param.Field[RateLimitNewParamsMatchRequest] `json:"request"`
Response param.Field[RateLimitNewParamsMatchResponse] `json:"response"`
}
Determines which traffic the rate limit counts towards the threshold.
func (RateLimitNewParamsMatch) MarshalJSON ¶
func (r RateLimitNewParamsMatch) MarshalJSON() (data []byte, err error)
type RateLimitNewParamsMatchHeader ¶
type RateLimitNewParamsMatchHeader struct {
// The name of the response header to match.
Name param.Field[string] `json:"name"`
// The operator used when matching: `eq` means "equal" and `ne` means "not equal".
Op param.Field[RateLimitNewParamsMatchHeadersOp] `json:"op"`
// The value of the response header, which must match exactly.
Value param.Field[string] `json:"value"`
}
func (RateLimitNewParamsMatchHeader) MarshalJSON ¶
func (r RateLimitNewParamsMatchHeader) MarshalJSON() (data []byte, err error)
type RateLimitNewParamsMatchHeadersOp ¶
type RateLimitNewParamsMatchHeadersOp string
The operator used when matching: `eq` means "equal" and `ne` means "not equal".
const ( RateLimitNewParamsMatchHeadersOpEq RateLimitNewParamsMatchHeadersOp = "eq" RateLimitNewParamsMatchHeadersOpNe RateLimitNewParamsMatchHeadersOp = "ne" )
func (RateLimitNewParamsMatchHeadersOp) IsKnown ¶
func (r RateLimitNewParamsMatchHeadersOp) IsKnown() bool
type RateLimitNewParamsMatchRequest ¶
type RateLimitNewParamsMatchRequest struct {
// The HTTP methods to match. You can specify a subset (for example,
// `['POST','PUT']`) or all methods (`['_ALL_']`). This field is optional when
// creating a rate limit.
Methods param.Field[[]Methods] `json:"methods"`
// The HTTP schemes to match. You can specify one scheme (`['HTTPS']`), both
// schemes (`['HTTP','HTTPS']`), or all schemes (`['_ALL_']`). This field is
// optional.
Schemes param.Field[[]string] `json:"schemes"`
// The URL pattern to match, composed of a host and a path such as
// `example.org/path*`. Normalization is applied before the pattern is matched. `*`
// wildcards are expanded to match applicable traffic. Query strings are not
// matched. Set the value to `*` to match all traffic to your zone.
URL param.Field[string] `json:"url"`
}
func (RateLimitNewParamsMatchRequest) MarshalJSON ¶
func (r RateLimitNewParamsMatchRequest) MarshalJSON() (data []byte, err error)
type RateLimitNewParamsMatchResponse ¶
type RateLimitNewParamsMatchResponse struct {
// When true, only the uncached traffic served from your origin servers will count
// towards rate limiting. In this case, any cached traffic served by Cloudflare
// will not count towards rate limiting. This field is optional. Notes: This field
// is deprecated. Instead, use response headers and set "origin_traffic" to "false"
// to avoid legacy behaviour interacting with the "response_headers" property.
OriginTraffic param.Field[bool] `json:"origin_traffic"`
}
func (RateLimitNewParamsMatchResponse) MarshalJSON ¶
func (r RateLimitNewParamsMatchResponse) MarshalJSON() (data []byte, err error)
type RateLimitNewResponseEnvelope ¶
type RateLimitNewResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
Result interface{} `json:"result,required"`
// Whether the API call was successful
Success RateLimitNewResponseEnvelopeSuccess `json:"success,required"`
JSON rateLimitNewResponseEnvelopeJSON `json:"-"`
}
func (*RateLimitNewResponseEnvelope) UnmarshalJSON ¶
func (r *RateLimitNewResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type RateLimitNewResponseEnvelopeSuccess ¶
type RateLimitNewResponseEnvelopeSuccess bool
Whether the API call was successful
const (
RateLimitNewResponseEnvelopeSuccessTrue RateLimitNewResponseEnvelopeSuccess = true
)
func (RateLimitNewResponseEnvelopeSuccess) IsKnown ¶
func (r RateLimitNewResponseEnvelopeSuccess) IsKnown() bool
type RateLimitService ¶
type RateLimitService struct {
Options []option.RequestOption
}
RateLimitService contains methods and other services that help with interacting with the cloudflare API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRateLimitService method instead.
func NewRateLimitService ¶
func NewRateLimitService(opts ...option.RequestOption) (r *RateLimitService)
NewRateLimitService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*RateLimitService) Delete
deprecated
func (r *RateLimitService) Delete(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *RateLimitDeleteResponse, err error)
Deletes an existing rate limit.
Deprecated: Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details.
func (*RateLimitService) Edit
deprecated
func (r *RateLimitService) Edit(ctx context.Context, zoneIdentifier string, id string, body RateLimitEditParams, opts ...option.RequestOption) (res *interface{}, err error)
Updates an existing rate limit.
Deprecated: Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details.
func (*RateLimitService) Get
deprecated
func (r *RateLimitService) Get(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *interface{}, err error)
Fetches the details of a rate limit.
Deprecated: Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details.
func (*RateLimitService) List
deprecated
func (r *RateLimitService) List(ctx context.Context, zoneIdentifier string, query RateLimitListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[RateLimit], err error)
Fetches the rate limits for a zone.
Deprecated: Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details.
func (*RateLimitService) ListAutoPaging
deprecated
func (r *RateLimitService) ListAutoPaging(ctx context.Context, zoneIdentifier string, query RateLimitListParams, opts ...option.RequestOption) *pagination.V4PagePaginationArrayAutoPager[RateLimit]
Fetches the rate limits for a zone.
Deprecated: Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details.
func (*RateLimitService) New
deprecated
func (r *RateLimitService) New(ctx context.Context, zoneIdentifier string, body RateLimitNewParams, opts ...option.RequestOption) (res *interface{}, err error)
Creates a new rate limit for a zone. Refer to the object definition for a list of required attributes.
Deprecated: Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details.
type RatePlanParam ¶
type RatePlanParam = shared.RatePlanParam
The rate plan applied to the subscription.
This is an alias to an internal type.
type SortDirection ¶
type SortDirection = shared.SortDirection
Direction to order DNS records in.
This is an alias to an internal type.
type SubscriptionFrequency ¶
type SubscriptionFrequency = shared.SubscriptionFrequency
How often the subscription is renewed automatically.
This is an alias to an internal type.
type SubscriptionParam ¶
type SubscriptionParam = shared.SubscriptionParam
This is an alias to an internal type.
type SubscriptionState ¶
type SubscriptionState = shared.SubscriptionState
The state that the subscription is in.
This is an alias to an internal type.