Documentation
¶
Index ¶
- type ConnectionGetParams
- type ConnectionListParams
- type ConnectionListParamsDirection
- type ConnectionListParamsExport
- type ConnectionListParamsOrderBy
- type ConnectionListResponseEnvelope
- type ConnectionListResponseEnvelopeErrors
- type ConnectionListResponseEnvelopeMessages
- type ConnectionListResponseEnvelopeResultInfo
- type ConnectionListResponseEnvelopeSuccess
- type ConnectionService
- type Error
- type PageShieldConnection
- type PageShieldGetParams
- type PageShieldGetResponseEnvelope
- type PageShieldGetResponseEnvelopeErrors
- type PageShieldGetResponseEnvelopeMessages
- type PageShieldGetResponseEnvelopeSuccess
- type PageShieldGetZoneSettings
- type PageShieldPageshieldPolicy
- type PageShieldPageshieldPolicyAction
- type PageShieldScript
- type PageShieldService
- type PageShieldUpdateParams
- type PageShieldUpdateResponseEnvelope
- type PageShieldUpdateResponseEnvelopeErrors
- type PageShieldUpdateResponseEnvelopeMessages
- type PageShieldUpdateResponseEnvelopeSuccess
- type PageShieldUpdateZoneSettings
- type PolicyDeleteParams
- type PolicyGetParams
- type PolicyListParams
- type PolicyListResponseEnvelope
- type PolicyListResponseEnvelopeErrors
- type PolicyListResponseEnvelopeMessages
- type PolicyListResponseEnvelopeResultInfo
- type PolicyListResponseEnvelopeSuccess
- type PolicyNewParams
- type PolicyNewParamsAction
- type PolicyService
- func (r *PolicyService) Delete(ctx context.Context, policyID string, body PolicyDeleteParams, ...) (err error)
- func (r *PolicyService) Get(ctx context.Context, policyID string, query PolicyGetParams, ...) (res *PageShieldPageshieldPolicy, err error)
- func (r *PolicyService) List(ctx context.Context, query PolicyListParams, opts ...option.RequestOption) (res *[]PageShieldPageshieldPolicy, err error)
- func (r *PolicyService) New(ctx context.Context, params PolicyNewParams, opts ...option.RequestOption) (res *PageShieldPageshieldPolicy, err error)
- func (r *PolicyService) Update(ctx context.Context, policyID string, params PolicyUpdateParams, ...) (res *PageShieldPageshieldPolicy, err error)
- type PolicyUpdateParams
- type PolicyUpdateParamsAction
- type ScriptGetParams
- type ScriptGetResponse
- type ScriptGetResponseVersion
- type ScriptListParams
- type ScriptListParamsDirection
- type ScriptListParamsExport
- type ScriptListParamsOrderBy
- type ScriptListResponseEnvelope
- type ScriptListResponseEnvelopeErrors
- type ScriptListResponseEnvelopeMessages
- type ScriptListResponseEnvelopeResultInfo
- type ScriptListResponseEnvelopeSuccess
- type ScriptService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionGetParams ¶
type ConnectionListParams ¶
type ConnectionListParams struct {
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
// The direction used to sort returned connections.
Direction param.Field[ConnectionListParamsDirection] `query:"direction"`
// When true, excludes connections seen in a `/cdn-cgi` path from the returned
// connections. The default value is true.
ExcludeCdnCgi param.Field[bool] `query:"exclude_cdn_cgi"`
// Excludes connections whose URL contains one of the URL-encoded URLs separated by
// commas.
ExcludeURLs param.Field[string] `query:"exclude_urls"`
// Export the list of connections as a file. Cannot be used with per_page or page
// options.
Export param.Field[ConnectionListParamsExport] `query:"export"`
// Includes connections that match one or more URL-encoded hostnames separated by
// commas.
//
// Wildcards are supported at the start and end of each hostname to support starts
// with, ends with and contains. If no wildcards are used, results will be filtered
// by exact match
Hosts param.Field[string] `query:"hosts"`
// The field used to sort returned connections.
OrderBy param.Field[ConnectionListParamsOrderBy] `query:"order_by"`
// The current page number of the paginated results.
//
// We additionally support a special value "all". When "all" is used, the API will
// return all the connections with the applied filters in a single page.
// Additionally, when using this value, the API will not return the categorisation
// data for the URL and domain of the connections. This feature is best-effort and
// it may only work for zones with a low number of connections
Page param.Field[string] `query:"page"`
// Includes connections that match one or more page URLs (separated by commas)
// where they were last seen
//
// Wildcards are supported at the start and end of each page URL to support starts
// with, ends with and contains. If no wildcards are used, results will be filtered
// by exact match
PageURL param.Field[string] `query:"page_url"`
// The number of results per page.
PerPage param.Field[float64] `query:"per_page"`
// When true, malicious connections appear first in the returned connections.
PrioritizeMalicious param.Field[bool] `query:"prioritize_malicious"`
// Filters the returned connections using a comma-separated list of connection
// statuses. Accepted values: `active`, `infrequent`, and `inactive`. The default
// value is `active`.
Status param.Field[string] `query:"status"`
// Includes connections whose URL contain one or more URL-encoded URLs separated by
// commas.
URLs param.Field[string] `query:"urls"`
}
func (ConnectionListParams) URLQuery ¶
func (r ConnectionListParams) URLQuery() (v url.Values)
URLQuery serializes ConnectionListParams's query parameters as `url.Values`.
type ConnectionListParamsDirection ¶
type ConnectionListParamsDirection string
The direction used to sort returned connections.
const ( ConnectionListParamsDirectionAsc ConnectionListParamsDirection = "asc" ConnectionListParamsDirectionDesc ConnectionListParamsDirection = "desc" )
type ConnectionListParamsExport ¶
type ConnectionListParamsExport string
Export the list of connections as a file. Cannot be used with per_page or page options.
const (
ConnectionListParamsExportCsv ConnectionListParamsExport = "csv"
)
type ConnectionListParamsOrderBy ¶
type ConnectionListParamsOrderBy string
The field used to sort returned connections.
const ( ConnectionListParamsOrderByFirstSeenAt ConnectionListParamsOrderBy = "first_seen_at" ConnectionListParamsOrderByLastSeenAt ConnectionListParamsOrderBy = "last_seen_at" )
type ConnectionListResponseEnvelope ¶
type ConnectionListResponseEnvelope struct {
Errors []ConnectionListResponseEnvelopeErrors `json:"errors,required"`
Messages []ConnectionListResponseEnvelopeMessages `json:"messages,required"`
Result []PageShieldConnection `json:"result,required,nullable"`
// Whether the API call was successful
Success ConnectionListResponseEnvelopeSuccess `json:"success,required"`
ResultInfo ConnectionListResponseEnvelopeResultInfo `json:"result_info"`
JSON connectionListResponseEnvelopeJSON `json:"-"`
}
func (*ConnectionListResponseEnvelope) UnmarshalJSON ¶
func (r *ConnectionListResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type ConnectionListResponseEnvelopeErrors ¶
type ConnectionListResponseEnvelopeErrors struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON connectionListResponseEnvelopeErrorsJSON `json:"-"`
}
func (*ConnectionListResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *ConnectionListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type ConnectionListResponseEnvelopeMessages ¶
type ConnectionListResponseEnvelopeMessages struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON connectionListResponseEnvelopeMessagesJSON `json:"-"`
}
func (*ConnectionListResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *ConnectionListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type ConnectionListResponseEnvelopeResultInfo ¶
type ConnectionListResponseEnvelopeResultInfo struct {
// Total number of results for the requested service
Count float64 `json:"count"`
// Current page within paginated list of results
Page float64 `json:"page"`
// Number of results per page of results
PerPage float64 `json:"per_page"`
// Total results available without any search parameters
TotalCount float64 `json:"total_count"`
JSON connectionListResponseEnvelopeResultInfoJSON `json:"-"`
}
func (*ConnectionListResponseEnvelopeResultInfo) UnmarshalJSON ¶
func (r *ConnectionListResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error)
type ConnectionListResponseEnvelopeSuccess ¶
type ConnectionListResponseEnvelopeSuccess bool
Whether the API call was successful
const (
ConnectionListResponseEnvelopeSuccessTrue ConnectionListResponseEnvelopeSuccess = true
)
type ConnectionService ¶
type ConnectionService struct {
Options []option.RequestOption
}
ConnectionService 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 NewConnectionService method instead.
func NewConnectionService ¶
func NewConnectionService(opts ...option.RequestOption) (r *ConnectionService)
NewConnectionService 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 (*ConnectionService) Get ¶
func (r *ConnectionService) Get(ctx context.Context, connectionID string, query ConnectionGetParams, opts ...option.RequestOption) (res *PageShieldConnection, err error)
Fetches a connection detected by Page Shield by connection ID.
func (*ConnectionService) List ¶
func (r *ConnectionService) List(ctx context.Context, params ConnectionListParams, opts ...option.RequestOption) (res *[]PageShieldConnection, err error)
Lists all connections detected by Page Shield.
type PageShieldConnection ¶
type PageShieldConnection struct {
ID interface{} `json:"id"`
AddedAt interface{} `json:"added_at"`
DomainReportedMalicious interface{} `json:"domain_reported_malicious"`
FirstPageURL interface{} `json:"first_page_url"`
FirstSeenAt interface{} `json:"first_seen_at"`
Host interface{} `json:"host"`
LastSeenAt interface{} `json:"last_seen_at"`
PageURLs interface{} `json:"page_urls"`
URL interface{} `json:"url"`
URLContainsCdnCgiPath interface{} `json:"url_contains_cdn_cgi_path"`
JSON pageShieldConnectionJSON `json:"-"`
}
func (*PageShieldConnection) UnmarshalJSON ¶
func (r *PageShieldConnection) UnmarshalJSON(data []byte) (err error)
type PageShieldGetParams ¶
type PageShieldGetResponseEnvelope ¶
type PageShieldGetResponseEnvelope struct {
Errors []PageShieldGetResponseEnvelopeErrors `json:"errors,required"`
Messages []PageShieldGetResponseEnvelopeMessages `json:"messages,required"`
Result PageShieldGetZoneSettings `json:"result,required"`
// Whether the API call was successful
Success PageShieldGetResponseEnvelopeSuccess `json:"success,required"`
JSON pageShieldGetResponseEnvelopeJSON `json:"-"`
}
func (*PageShieldGetResponseEnvelope) UnmarshalJSON ¶
func (r *PageShieldGetResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type PageShieldGetResponseEnvelopeErrors ¶
type PageShieldGetResponseEnvelopeErrors struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON pageShieldGetResponseEnvelopeErrorsJSON `json:"-"`
}
func (*PageShieldGetResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *PageShieldGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type PageShieldGetResponseEnvelopeMessages ¶
type PageShieldGetResponseEnvelopeMessages struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON pageShieldGetResponseEnvelopeMessagesJSON `json:"-"`
}
func (*PageShieldGetResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *PageShieldGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type PageShieldGetResponseEnvelopeSuccess ¶
type PageShieldGetResponseEnvelopeSuccess bool
Whether the API call was successful
const (
PageShieldGetResponseEnvelopeSuccessTrue PageShieldGetResponseEnvelopeSuccess = true
)
type PageShieldGetZoneSettings ¶
type PageShieldGetZoneSettings struct {
// When true, indicates that Page Shield is enabled.
Enabled bool `json:"enabled"`
// The timestamp of when Page Shield was last updated.
UpdatedAt string `json:"updated_at"`
// When true, CSP reports will be sent to
// https://csp-reporting.cloudflare.com/cdn-cgi/script_monitor/report
UseCloudflareReportingEndpoint bool `json:"use_cloudflare_reporting_endpoint"`
// When true, the paths associated with connections URLs will also be analyzed.
UseConnectionURLPath bool `json:"use_connection_url_path"`
JSON pageShieldGetZoneSettingsJSON `json:"-"`
}
func (*PageShieldGetZoneSettings) UnmarshalJSON ¶
func (r *PageShieldGetZoneSettings) UnmarshalJSON(data []byte) (err error)
type PageShieldPageshieldPolicy ¶
type PageShieldPageshieldPolicy struct {
// The ID of the policy
ID string `json:"id"`
// The action to take if the expression matches
Action PageShieldPageshieldPolicyAction `json:"action"`
// A description for the policy
Description string `json:"description"`
// Whether the policy is enabled
Enabled bool `json:"enabled"`
// The expression which must match for the policy to be applied, using the
// Cloudflare Firewall rule expression syntax
Expression string `json:"expression"`
// The policy which will be applied
Value string `json:"value"`
JSON pageShieldPageshieldPolicyJSON `json:"-"`
}
func (*PageShieldPageshieldPolicy) UnmarshalJSON ¶
func (r *PageShieldPageshieldPolicy) UnmarshalJSON(data []byte) (err error)
type PageShieldPageshieldPolicyAction ¶
type PageShieldPageshieldPolicyAction string
The action to take if the expression matches
const ( PageShieldPageshieldPolicyActionAllow PageShieldPageshieldPolicyAction = "allow" PageShieldPageshieldPolicyActionLog PageShieldPageshieldPolicyAction = "log" )
type PageShieldScript ¶
type PageShieldScript struct {
ID interface{} `json:"id"`
AddedAt interface{} `json:"added_at"`
DomainReportedMalicious interface{} `json:"domain_reported_malicious"`
FetchedAt interface{} `json:"fetched_at"`
FirstPageURL interface{} `json:"first_page_url"`
FirstSeenAt interface{} `json:"first_seen_at"`
Hash interface{} `json:"hash"`
Host interface{} `json:"host"`
JsIntegrityScore interface{} `json:"js_integrity_score"`
LastSeenAt interface{} `json:"last_seen_at"`
PageURLs interface{} `json:"page_urls"`
URL interface{} `json:"url"`
URLContainsCdnCgiPath interface{} `json:"url_contains_cdn_cgi_path"`
JSON pageShieldScriptJSON `json:"-"`
}
func (*PageShieldScript) UnmarshalJSON ¶
func (r *PageShieldScript) UnmarshalJSON(data []byte) (err error)
type PageShieldService ¶
type PageShieldService struct {
Options []option.RequestOption
Policies *PolicyService
Connections *ConnectionService
Scripts *ScriptService
}
PageShieldService 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 NewPageShieldService method instead.
func NewPageShieldService ¶
func NewPageShieldService(opts ...option.RequestOption) (r *PageShieldService)
NewPageShieldService 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 (*PageShieldService) Get ¶
func (r *PageShieldService) Get(ctx context.Context, query PageShieldGetParams, opts ...option.RequestOption) (res *PageShieldGetZoneSettings, err error)
Fetches the Page Shield settings.
func (*PageShieldService) Update ¶
func (r *PageShieldService) Update(ctx context.Context, params PageShieldUpdateParams, opts ...option.RequestOption) (res *PageShieldUpdateZoneSettings, err error)
Updates Page Shield settings.
type PageShieldUpdateParams ¶
type PageShieldUpdateParams struct {
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
// When true, indicates that Page Shield is enabled.
Enabled param.Field[bool] `json:"enabled"`
// When true, CSP reports will be sent to
// https://csp-reporting.cloudflare.com/cdn-cgi/script_monitor/report
UseCloudflareReportingEndpoint param.Field[bool] `json:"use_cloudflare_reporting_endpoint"`
// When true, the paths associated with connections URLs will also be analyzed.
UseConnectionURLPath param.Field[bool] `json:"use_connection_url_path"`
}
func (PageShieldUpdateParams) MarshalJSON ¶
func (r PageShieldUpdateParams) MarshalJSON() (data []byte, err error)
type PageShieldUpdateResponseEnvelope ¶
type PageShieldUpdateResponseEnvelope struct {
Errors []PageShieldUpdateResponseEnvelopeErrors `json:"errors,required"`
Messages []PageShieldUpdateResponseEnvelopeMessages `json:"messages,required"`
Result PageShieldUpdateZoneSettings `json:"result,required"`
// Whether the API call was successful
Success PageShieldUpdateResponseEnvelopeSuccess `json:"success,required"`
JSON pageShieldUpdateResponseEnvelopeJSON `json:"-"`
}
func (*PageShieldUpdateResponseEnvelope) UnmarshalJSON ¶
func (r *PageShieldUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type PageShieldUpdateResponseEnvelopeErrors ¶
type PageShieldUpdateResponseEnvelopeErrors struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON pageShieldUpdateResponseEnvelopeErrorsJSON `json:"-"`
}
func (*PageShieldUpdateResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *PageShieldUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type PageShieldUpdateResponseEnvelopeMessages ¶
type PageShieldUpdateResponseEnvelopeMessages struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON pageShieldUpdateResponseEnvelopeMessagesJSON `json:"-"`
}
func (*PageShieldUpdateResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *PageShieldUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type PageShieldUpdateResponseEnvelopeSuccess ¶
type PageShieldUpdateResponseEnvelopeSuccess bool
Whether the API call was successful
const (
PageShieldUpdateResponseEnvelopeSuccessTrue PageShieldUpdateResponseEnvelopeSuccess = true
)
type PageShieldUpdateZoneSettings ¶
type PageShieldUpdateZoneSettings struct {
// When true, indicates that Page Shield is enabled.
Enabled bool `json:"enabled"`
// The timestamp of when Page Shield was last updated.
UpdatedAt string `json:"updated_at"`
// When true, CSP reports will be sent to
// https://csp-reporting.cloudflare.com/cdn-cgi/script_monitor/report
UseCloudflareReportingEndpoint bool `json:"use_cloudflare_reporting_endpoint"`
// When true, the paths associated with connections URLs will also be analyzed.
UseConnectionURLPath bool `json:"use_connection_url_path"`
JSON pageShieldUpdateZoneSettingsJSON `json:"-"`
}
func (*PageShieldUpdateZoneSettings) UnmarshalJSON ¶
func (r *PageShieldUpdateZoneSettings) UnmarshalJSON(data []byte) (err error)
type PolicyDeleteParams ¶
type PolicyGetParams ¶
type PolicyListParams ¶
type PolicyListResponseEnvelope ¶
type PolicyListResponseEnvelope struct {
Errors []PolicyListResponseEnvelopeErrors `json:"errors,required"`
Messages []PolicyListResponseEnvelopeMessages `json:"messages,required"`
Result []PageShieldPageshieldPolicy `json:"result,required,nullable"`
// Whether the API call was successful
Success PolicyListResponseEnvelopeSuccess `json:"success,required"`
ResultInfo PolicyListResponseEnvelopeResultInfo `json:"result_info"`
JSON policyListResponseEnvelopeJSON `json:"-"`
}
func (*PolicyListResponseEnvelope) UnmarshalJSON ¶
func (r *PolicyListResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type PolicyListResponseEnvelopeErrors ¶
type PolicyListResponseEnvelopeErrors struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON policyListResponseEnvelopeErrorsJSON `json:"-"`
}
func (*PolicyListResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *PolicyListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type PolicyListResponseEnvelopeMessages ¶
type PolicyListResponseEnvelopeMessages struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON policyListResponseEnvelopeMessagesJSON `json:"-"`
}
func (*PolicyListResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *PolicyListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type PolicyListResponseEnvelopeResultInfo ¶
type PolicyListResponseEnvelopeResultInfo struct {
// Total number of results for the requested service
Count float64 `json:"count"`
// Current page within paginated list of results
Page float64 `json:"page"`
// Number of results per page of results
PerPage float64 `json:"per_page"`
// Total results available without any search parameters
TotalCount float64 `json:"total_count"`
JSON policyListResponseEnvelopeResultInfoJSON `json:"-"`
}
func (*PolicyListResponseEnvelopeResultInfo) UnmarshalJSON ¶
func (r *PolicyListResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error)
type PolicyListResponseEnvelopeSuccess ¶
type PolicyListResponseEnvelopeSuccess bool
Whether the API call was successful
const (
PolicyListResponseEnvelopeSuccessTrue PolicyListResponseEnvelopeSuccess = true
)
type PolicyNewParams ¶
type PolicyNewParams struct {
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
// The action to take if the expression matches
Action param.Field[PolicyNewParamsAction] `json:"action"`
// A description for the policy
Description param.Field[string] `json:"description"`
// Whether the policy is enabled
Enabled param.Field[bool] `json:"enabled"`
// The expression which must match for the policy to be applied, using the
// Cloudflare Firewall rule expression syntax
Expression param.Field[string] `json:"expression"`
// The policy which will be applied
Value param.Field[string] `json:"value"`
}
func (PolicyNewParams) MarshalJSON ¶
func (r PolicyNewParams) MarshalJSON() (data []byte, err error)
type PolicyNewParamsAction ¶
type PolicyNewParamsAction string
The action to take if the expression matches
const ( PolicyNewParamsActionAllow PolicyNewParamsAction = "allow" PolicyNewParamsActionLog PolicyNewParamsAction = "log" )
type PolicyService ¶
type PolicyService struct {
Options []option.RequestOption
}
PolicyService 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 NewPolicyService method instead.
func NewPolicyService ¶
func NewPolicyService(opts ...option.RequestOption) (r *PolicyService)
NewPolicyService 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 (*PolicyService) Delete ¶
func (r *PolicyService) Delete(ctx context.Context, policyID string, body PolicyDeleteParams, opts ...option.RequestOption) (err error)
Delete a Page Shield policy by ID.
func (*PolicyService) Get ¶
func (r *PolicyService) Get(ctx context.Context, policyID string, query PolicyGetParams, opts ...option.RequestOption) (res *PageShieldPageshieldPolicy, err error)
Fetches a Page Shield policy by ID.
func (*PolicyService) List ¶
func (r *PolicyService) List(ctx context.Context, query PolicyListParams, opts ...option.RequestOption) (res *[]PageShieldPageshieldPolicy, err error)
Lists all Page Shield policies.
func (*PolicyService) New ¶
func (r *PolicyService) New(ctx context.Context, params PolicyNewParams, opts ...option.RequestOption) (res *PageShieldPageshieldPolicy, err error)
Create a Page Shield policy.
func (*PolicyService) Update ¶
func (r *PolicyService) Update(ctx context.Context, policyID string, params PolicyUpdateParams, opts ...option.RequestOption) (res *PageShieldPageshieldPolicy, err error)
Update a Page Shield policy by ID.
type PolicyUpdateParams ¶
type PolicyUpdateParams struct {
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
// The action to take if the expression matches
Action param.Field[PolicyUpdateParamsAction] `json:"action"`
// A description for the policy
Description param.Field[string] `json:"description"`
// Whether the policy is enabled
Enabled param.Field[bool] `json:"enabled"`
// The expression which must match for the policy to be applied, using the
// Cloudflare Firewall rule expression syntax
Expression param.Field[string] `json:"expression"`
// The policy which will be applied
Value param.Field[string] `json:"value"`
}
func (PolicyUpdateParams) MarshalJSON ¶
func (r PolicyUpdateParams) MarshalJSON() (data []byte, err error)
type PolicyUpdateParamsAction ¶
type PolicyUpdateParamsAction string
The action to take if the expression matches
const ( PolicyUpdateParamsActionAllow PolicyUpdateParamsAction = "allow" PolicyUpdateParamsActionLog PolicyUpdateParamsAction = "log" )
type ScriptGetParams ¶
type ScriptGetResponse ¶
type ScriptGetResponse struct {
ID interface{} `json:"id"`
AddedAt interface{} `json:"added_at"`
DomainReportedMalicious interface{} `json:"domain_reported_malicious"`
FetchedAt interface{} `json:"fetched_at"`
FirstPageURL interface{} `json:"first_page_url"`
FirstSeenAt interface{} `json:"first_seen_at"`
Hash interface{} `json:"hash"`
Host interface{} `json:"host"`
JsIntegrityScore interface{} `json:"js_integrity_score"`
LastSeenAt interface{} `json:"last_seen_at"`
PageURLs interface{} `json:"page_urls"`
URL interface{} `json:"url"`
URLContainsCdnCgiPath interface{} `json:"url_contains_cdn_cgi_path"`
Versions []ScriptGetResponseVersion `json:"versions,nullable"`
JSON scriptGetResponseJSON `json:"-"`
}
func (*ScriptGetResponse) UnmarshalJSON ¶
func (r *ScriptGetResponse) UnmarshalJSON(data []byte) (err error)
type ScriptGetResponseVersion ¶
type ScriptGetResponseVersion struct {
// 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"`
JSON scriptGetResponseVersionJSON `json:"-"`
}
The version of the analyzed script.
func (*ScriptGetResponseVersion) UnmarshalJSON ¶
func (r *ScriptGetResponseVersion) UnmarshalJSON(data []byte) (err error)
type ScriptListParams ¶
type ScriptListParams struct {
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
// The direction used to sort returned scripts.
Direction param.Field[ScriptListParamsDirection] `query:"direction"`
// When true, excludes scripts seen in a `/cdn-cgi` path from the returned scripts.
// The default value is true.
ExcludeCdnCgi param.Field[bool] `query:"exclude_cdn_cgi"`
// When true, excludes duplicate scripts. We consider a script duplicate of another
// if their javascript content matches and they share the same url host and zone
// hostname. In such case, we return the most recent script for the URL host and
// zone hostname combination.
ExcludeDuplicates param.Field[bool] `query:"exclude_duplicates"`
// Excludes scripts whose URL contains one of the URL-encoded URLs separated by
// commas.
ExcludeURLs param.Field[string] `query:"exclude_urls"`
// Export the list of scripts as a file. Cannot be used with per_page or page
// options.
Export param.Field[ScriptListParamsExport] `query:"export"`
// Includes scripts that match one or more URL-encoded hostnames separated by
// commas.
//
// Wildcards are supported at the start and end of each hostname to support starts
// with, ends with and contains. If no wildcards are used, results will be filtered
// by exact match
Hosts param.Field[string] `query:"hosts"`
// The field used to sort returned scripts.
OrderBy param.Field[ScriptListParamsOrderBy] `query:"order_by"`
// The current page number of the paginated results.
//
// We additionally support a special value "all". When "all" is used, the API will
// return all the scripts with the applied filters in a single page. Additionally,
// when using this value, the API will not return the script versions or
// categorisation data for the URL and domain of the scripts. This feature is
// best-effort and it may only work for zones with a low number of scripts
Page param.Field[string] `query:"page"`
// Includes scripts that match one or more page URLs (separated by commas) where
// they were last seen
//
// Wildcards are supported at the start and end of each page URL to support starts
// with, ends with and contains. If no wildcards are used, results will be filtered
// by exact match
PageURL param.Field[string] `query:"page_url"`
// The number of results per page.
PerPage param.Field[float64] `query:"per_page"`
// When true, malicious scripts appear first in the returned scripts.
PrioritizeMalicious param.Field[bool] `query:"prioritize_malicious"`
// Filters the returned scripts using a comma-separated list of scripts statuses.
// Accepted values: `active`, `infrequent`, and `inactive`. The default value is
// `active`.
Status param.Field[string] `query:"status"`
// Includes scripts whose URL contain one or more URL-encoded URLs separated by
// commas.
URLs param.Field[string] `query:"urls"`
}
func (ScriptListParams) URLQuery ¶
func (r ScriptListParams) URLQuery() (v url.Values)
URLQuery serializes ScriptListParams's query parameters as `url.Values`.
type ScriptListParamsDirection ¶
type ScriptListParamsDirection string
The direction used to sort returned scripts.
const ( ScriptListParamsDirectionAsc ScriptListParamsDirection = "asc" ScriptListParamsDirectionDesc ScriptListParamsDirection = "desc" )
type ScriptListParamsExport ¶
type ScriptListParamsExport string
Export the list of scripts as a file. Cannot be used with per_page or page options.
const (
ScriptListParamsExportCsv ScriptListParamsExport = "csv"
)
type ScriptListParamsOrderBy ¶
type ScriptListParamsOrderBy string
The field used to sort returned scripts.
const ( ScriptListParamsOrderByFirstSeenAt ScriptListParamsOrderBy = "first_seen_at" ScriptListParamsOrderByLastSeenAt ScriptListParamsOrderBy = "last_seen_at" )
type ScriptListResponseEnvelope ¶
type ScriptListResponseEnvelope struct {
Errors []ScriptListResponseEnvelopeErrors `json:"errors,required"`
Messages []ScriptListResponseEnvelopeMessages `json:"messages,required"`
Result []PageShieldScript `json:"result,required,nullable"`
// Whether the API call was successful
Success ScriptListResponseEnvelopeSuccess `json:"success,required"`
ResultInfo ScriptListResponseEnvelopeResultInfo `json:"result_info"`
JSON scriptListResponseEnvelopeJSON `json:"-"`
}
func (*ScriptListResponseEnvelope) UnmarshalJSON ¶
func (r *ScriptListResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type ScriptListResponseEnvelopeErrors ¶
type ScriptListResponseEnvelopeErrors struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON scriptListResponseEnvelopeErrorsJSON `json:"-"`
}
func (*ScriptListResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *ScriptListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type ScriptListResponseEnvelopeMessages ¶
type ScriptListResponseEnvelopeMessages struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON scriptListResponseEnvelopeMessagesJSON `json:"-"`
}
func (*ScriptListResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *ScriptListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type ScriptListResponseEnvelopeResultInfo ¶
type ScriptListResponseEnvelopeResultInfo struct {
// Total number of results for the requested service
Count float64 `json:"count"`
// Current page within paginated list of results
Page float64 `json:"page"`
// Number of results per page of results
PerPage float64 `json:"per_page"`
// Total results available without any search parameters
TotalCount float64 `json:"total_count"`
JSON scriptListResponseEnvelopeResultInfoJSON `json:"-"`
}
func (*ScriptListResponseEnvelopeResultInfo) UnmarshalJSON ¶
func (r *ScriptListResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error)
type ScriptListResponseEnvelopeSuccess ¶
type ScriptListResponseEnvelopeSuccess bool
Whether the API call was successful
const (
ScriptListResponseEnvelopeSuccessTrue ScriptListResponseEnvelopeSuccess = true
)
type ScriptService ¶
type ScriptService struct {
Options []option.RequestOption
}
ScriptService 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 NewScriptService method instead.
func NewScriptService ¶
func NewScriptService(opts ...option.RequestOption) (r *ScriptService)
NewScriptService 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 (*ScriptService) Get ¶
func (r *ScriptService) Get(ctx context.Context, scriptID string, query ScriptGetParams, opts ...option.RequestOption) (res *ScriptGetResponse, err error)
Fetches a script detected by Page Shield by script ID.
func (*ScriptService) List ¶
func (r *ScriptService) List(ctx context.Context, params ScriptListParams, opts ...option.RequestOption) (res *[]PageShieldScript, err error)
Lists all scripts detected by Page Shield.