# Operations ## Retrieve information about all operations on a zone `client.APIGateway.Operations.List(ctx, params) (*V4PagePaginationArray[OperationListResponse], error)` **get** `/zones/{zone_id}/api_gateway/operations` Lists all API operations tracked by API Shield for a zone with pagination. Returns operation details including method, path, and feature configurations. ### Parameters - `params OperationListParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Direction param.Field[OperationListParamsDirection]` Query param: Direction to order results. - `const OperationListParamsDirectionAsc OperationListParamsDirection = "asc"` - `const OperationListParamsDirectionDesc OperationListParamsDirection = "desc"` - `Endpoint param.Field[string]` Query param: Filter results to only include endpoints containing this pattern. - `Feature param.Field[[]OperationListParamsFeature]` Query param: Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning. - `const OperationListParamsFeatureThresholds OperationListParamsFeature = "thresholds"` - `const OperationListParamsFeatureParameterSchemas OperationListParamsFeature = "parameter_schemas"` - `const OperationListParamsFeatureSchemaInfo OperationListParamsFeature = "schema_info"` - `Host param.Field[[]string]` Query param: Filter results to only include the specified hosts. - `Method param.Field[[]string]` Query param: Filter results to only include the specified HTTP methods. - `Order param.Field[OperationListParamsOrder]` Query param: Field to order by. When requesting a feature, the feature keys are available for ordering as well, e.g., `thresholds.suggested_threshold`. - `const OperationListParamsOrderMethod OperationListParamsOrder = "method"` - `const OperationListParamsOrderHost OperationListParamsOrder = "host"` - `const OperationListParamsOrderEndpoint OperationListParamsOrder = "endpoint"` - `const OperationListParamsOrderThresholdsKey OperationListParamsOrder = "thresholds.$key"` - `Page param.Field[int64]` Query param: Page number of paginated results. - `PerPage param.Field[int64]` Query param: Maximum number of results per page. ### Returns - `type OperationListResponse struct{…}` - `Endpoint string` The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/. - `Host string` RFC3986-compliant host. - `LastUpdated Time` - `Method OperationListResponseMethod` The HTTP method used to access the endpoint. - `const OperationListResponseMethodGet OperationListResponseMethod = "GET"` - `const OperationListResponseMethodPost OperationListResponseMethod = "POST"` - `const OperationListResponseMethodHead OperationListResponseMethod = "HEAD"` - `const OperationListResponseMethodOptions OperationListResponseMethod = "OPTIONS"` - `const OperationListResponseMethodPut OperationListResponseMethod = "PUT"` - `const OperationListResponseMethodDelete OperationListResponseMethod = "DELETE"` - `const OperationListResponseMethodConnect OperationListResponseMethod = "CONNECT"` - `const OperationListResponseMethodPatch OperationListResponseMethod = "PATCH"` - `const OperationListResponseMethodTrace OperationListResponseMethod = "TRACE"` - `OperationID string` UUID. - `Features OperationListResponseFeatures` - `type OperationListResponseFeaturesAPIShieldOperationFeatureThresholds struct{…}` - `Thresholds OperationListResponseFeaturesAPIShieldOperationFeatureThresholdsThresholds` - `AuthIDTokens int64` The total number of auth-ids seen across this calculation. - `DataPoints int64` The number of data points used for the threshold suggestion calculation. - `LastUpdated Time` - `P50 int64` The p50 quantile of requests (in period_seconds). - `P90 int64` The p90 quantile of requests (in period_seconds). - `P99 int64` The p99 quantile of requests (in period_seconds). - `PeriodSeconds int64` The period over which this threshold is suggested. - `Requests int64` The estimated number of requests covered by these calculations. - `SuggestedThreshold int64` The suggested threshold in requests done by the same auth_id or period_seconds. - `type OperationListResponseFeaturesAPIShieldOperationFeatureParameterSchemas struct{…}` - `ParameterSchemas OperationListResponseFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas` - `LastUpdated Time` - `ParameterSchemas OperationListResponseFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas` An operation schema object containing a response. - `Parameters []unknown` An array containing the learned parameter schemas. - `Responses unknown` An empty response object. This field is required to yield a valid operation schema. - `type OperationListResponseFeaturesAPIShieldOperationFeatureAPIRouting struct{…}` - `APIRouting OperationListResponseFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting` API Routing settings on endpoint. - `LastUpdated Time` - `Route string` Target route. - `type OperationListResponseFeaturesAPIShieldOperationFeatureConfidenceIntervals struct{…}` - `ConfidenceIntervals OperationListResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals` - `LastUpdated Time` - `SuggestedThreshold OperationListResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold` - `ConfidenceIntervals OperationListResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals` - `P90 OperationListResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `P95 OperationListResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `P99 OperationListResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `Mean float64` Suggested threshold. - `type OperationListResponseFeaturesAPIShieldOperationFeatureSchemaInfo struct{…}` - `SchemaInfo OperationListResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo` - `ActiveSchema OperationListResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema` Schema active on endpoint. - `ID string` UUID. - `CreatedAt Time` - `IsLearned bool` True if schema is Cloudflare-provided. - `Name string` Schema file name. - `LearnedAvailable bool` True if a Cloudflare-provided learned schema is available for this endpoint. - `MitigationAction OperationListResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction` Action taken on requests failing validation. - `const OperationListResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionNone OperationListResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "none"` - `const OperationListResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionLog OperationListResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "log"` - `const OperationListResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionBlock OperationListResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "block"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.APIGateway.Operations.List(context.TODO(), api_gateway.OperationListParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "features": { "thresholds": { "auth_id_tokens": 0, "data_points": 0, "last_updated": "2014-01-01T05:20:00.12345Z", "p50": 0, "p90": 0, "p99": 0, "period_seconds": 0, "requests": 0, "suggested_threshold": 0 } } } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Retrieve information about an operation `client.APIGateway.Operations.Get(ctx, operationID, params) (*OperationGetResponse, error)` **get** `/zones/{zone_id}/api_gateway/operations/{operation_id}` Gets detailed information about a specific API operation in API Shield, including its schema validation settings and traffic statistics. ### Parameters - `operationID string` UUID. - `params OperationGetParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Feature param.Field[[]OperationGetParamsFeature]` Query param: Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning. - `const OperationGetParamsFeatureThresholds OperationGetParamsFeature = "thresholds"` - `const OperationGetParamsFeatureParameterSchemas OperationGetParamsFeature = "parameter_schemas"` - `const OperationGetParamsFeatureSchemaInfo OperationGetParamsFeature = "schema_info"` ### Returns - `type OperationGetResponse struct{…}` - `Endpoint string` The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/. - `Host string` RFC3986-compliant host. - `LastUpdated Time` - `Method OperationGetResponseMethod` The HTTP method used to access the endpoint. - `const OperationGetResponseMethodGet OperationGetResponseMethod = "GET"` - `const OperationGetResponseMethodPost OperationGetResponseMethod = "POST"` - `const OperationGetResponseMethodHead OperationGetResponseMethod = "HEAD"` - `const OperationGetResponseMethodOptions OperationGetResponseMethod = "OPTIONS"` - `const OperationGetResponseMethodPut OperationGetResponseMethod = "PUT"` - `const OperationGetResponseMethodDelete OperationGetResponseMethod = "DELETE"` - `const OperationGetResponseMethodConnect OperationGetResponseMethod = "CONNECT"` - `const OperationGetResponseMethodPatch OperationGetResponseMethod = "PATCH"` - `const OperationGetResponseMethodTrace OperationGetResponseMethod = "TRACE"` - `OperationID string` UUID. - `Features OperationGetResponseFeatures` - `type OperationGetResponseFeaturesAPIShieldOperationFeatureThresholds struct{…}` - `Thresholds OperationGetResponseFeaturesAPIShieldOperationFeatureThresholdsThresholds` - `AuthIDTokens int64` The total number of auth-ids seen across this calculation. - `DataPoints int64` The number of data points used for the threshold suggestion calculation. - `LastUpdated Time` - `P50 int64` The p50 quantile of requests (in period_seconds). - `P90 int64` The p90 quantile of requests (in period_seconds). - `P99 int64` The p99 quantile of requests (in period_seconds). - `PeriodSeconds int64` The period over which this threshold is suggested. - `Requests int64` The estimated number of requests covered by these calculations. - `SuggestedThreshold int64` The suggested threshold in requests done by the same auth_id or period_seconds. - `type OperationGetResponseFeaturesAPIShieldOperationFeatureParameterSchemas struct{…}` - `ParameterSchemas OperationGetResponseFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas` - `LastUpdated Time` - `ParameterSchemas OperationGetResponseFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas` An operation schema object containing a response. - `Parameters []unknown` An array containing the learned parameter schemas. - `Responses unknown` An empty response object. This field is required to yield a valid operation schema. - `type OperationGetResponseFeaturesAPIShieldOperationFeatureAPIRouting struct{…}` - `APIRouting OperationGetResponseFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting` API Routing settings on endpoint. - `LastUpdated Time` - `Route string` Target route. - `type OperationGetResponseFeaturesAPIShieldOperationFeatureConfidenceIntervals struct{…}` - `ConfidenceIntervals OperationGetResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals` - `LastUpdated Time` - `SuggestedThreshold OperationGetResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold` - `ConfidenceIntervals OperationGetResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals` - `P90 OperationGetResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `P95 OperationGetResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `P99 OperationGetResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `Mean float64` Suggested threshold. - `type OperationGetResponseFeaturesAPIShieldOperationFeatureSchemaInfo struct{…}` - `SchemaInfo OperationGetResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo` - `ActiveSchema OperationGetResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema` Schema active on endpoint. - `ID string` UUID. - `CreatedAt Time` - `IsLearned bool` True if schema is Cloudflare-provided. - `Name string` Schema file name. - `LearnedAvailable bool` True if a Cloudflare-provided learned schema is available for this endpoint. - `MitigationAction OperationGetResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction` Action taken on requests failing validation. - `const OperationGetResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionNone OperationGetResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "none"` - `const OperationGetResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionLog OperationGetResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "log"` - `const OperationGetResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionBlock OperationGetResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "block"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) operation, err := client.APIGateway.Operations.Get( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", api_gateway.OperationGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", operation.OperationID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "features": { "thresholds": { "auth_id_tokens": 0, "data_points": 0, "last_updated": "2014-01-01T05:20:00.12345Z", "p50": 0, "p90": 0, "p99": 0, "period_seconds": 0, "requests": 0, "suggested_threshold": 0 } } }, "success": true } ``` ## Add one operation to a zone `client.APIGateway.Operations.New(ctx, params) (*OperationNewResponse, error)` **post** `/zones/{zone_id}/api_gateway/operations/item` Add one operation to a zone. Endpoints can contain path variables. Host, method, endpoint will be normalized to a canoncial form when creating an operation and must be unique on the zone. Inserting an operation that matches an existing one will return the record of the already existing operation and update its last_updated date. ### Parameters - `params OperationNewParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Endpoint param.Field[string]` Body param: The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/. - `Host param.Field[string]` Body param: RFC3986-compliant host. - `Method param.Field[OperationNewParamsMethod]` Body param: The HTTP method used to access the endpoint. - `const OperationNewParamsMethodGet OperationNewParamsMethod = "GET"` - `const OperationNewParamsMethodPost OperationNewParamsMethod = "POST"` - `const OperationNewParamsMethodHead OperationNewParamsMethod = "HEAD"` - `const OperationNewParamsMethodOptions OperationNewParamsMethod = "OPTIONS"` - `const OperationNewParamsMethodPut OperationNewParamsMethod = "PUT"` - `const OperationNewParamsMethodDelete OperationNewParamsMethod = "DELETE"` - `const OperationNewParamsMethodConnect OperationNewParamsMethod = "CONNECT"` - `const OperationNewParamsMethodPatch OperationNewParamsMethod = "PATCH"` - `const OperationNewParamsMethodTrace OperationNewParamsMethod = "TRACE"` ### Returns - `type OperationNewResponse struct{…}` - `Endpoint string` The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/. - `Host string` RFC3986-compliant host. - `LastUpdated Time` - `Method OperationNewResponseMethod` The HTTP method used to access the endpoint. - `const OperationNewResponseMethodGet OperationNewResponseMethod = "GET"` - `const OperationNewResponseMethodPost OperationNewResponseMethod = "POST"` - `const OperationNewResponseMethodHead OperationNewResponseMethod = "HEAD"` - `const OperationNewResponseMethodOptions OperationNewResponseMethod = "OPTIONS"` - `const OperationNewResponseMethodPut OperationNewResponseMethod = "PUT"` - `const OperationNewResponseMethodDelete OperationNewResponseMethod = "DELETE"` - `const OperationNewResponseMethodConnect OperationNewResponseMethod = "CONNECT"` - `const OperationNewResponseMethodPatch OperationNewResponseMethod = "PATCH"` - `const OperationNewResponseMethodTrace OperationNewResponseMethod = "TRACE"` - `OperationID string` UUID. - `Features OperationNewResponseFeatures` - `type OperationNewResponseFeaturesAPIShieldOperationFeatureThresholds struct{…}` - `Thresholds OperationNewResponseFeaturesAPIShieldOperationFeatureThresholdsThresholds` - `AuthIDTokens int64` The total number of auth-ids seen across this calculation. - `DataPoints int64` The number of data points used for the threshold suggestion calculation. - `LastUpdated Time` - `P50 int64` The p50 quantile of requests (in period_seconds). - `P90 int64` The p90 quantile of requests (in period_seconds). - `P99 int64` The p99 quantile of requests (in period_seconds). - `PeriodSeconds int64` The period over which this threshold is suggested. - `Requests int64` The estimated number of requests covered by these calculations. - `SuggestedThreshold int64` The suggested threshold in requests done by the same auth_id or period_seconds. - `type OperationNewResponseFeaturesAPIShieldOperationFeatureParameterSchemas struct{…}` - `ParameterSchemas OperationNewResponseFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas` - `LastUpdated Time` - `ParameterSchemas OperationNewResponseFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas` An operation schema object containing a response. - `Parameters []unknown` An array containing the learned parameter schemas. - `Responses unknown` An empty response object. This field is required to yield a valid operation schema. - `type OperationNewResponseFeaturesAPIShieldOperationFeatureAPIRouting struct{…}` - `APIRouting OperationNewResponseFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting` API Routing settings on endpoint. - `LastUpdated Time` - `Route string` Target route. - `type OperationNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervals struct{…}` - `ConfidenceIntervals OperationNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals` - `LastUpdated Time` - `SuggestedThreshold OperationNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold` - `ConfidenceIntervals OperationNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals` - `P90 OperationNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `P95 OperationNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `P99 OperationNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `Mean float64` Suggested threshold. - `type OperationNewResponseFeaturesAPIShieldOperationFeatureSchemaInfo struct{…}` - `SchemaInfo OperationNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo` - `ActiveSchema OperationNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema` Schema active on endpoint. - `ID string` UUID. - `CreatedAt Time` - `IsLearned bool` True if schema is Cloudflare-provided. - `Name string` Schema file name. - `LearnedAvailable bool` True if a Cloudflare-provided learned schema is available for this endpoint. - `MitigationAction OperationNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction` Action taken on requests failing validation. - `const OperationNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionNone OperationNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "none"` - `const OperationNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionLog OperationNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "log"` - `const OperationNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionBlock OperationNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "block"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) operation, err := client.APIGateway.Operations.New(context.TODO(), api_gateway.OperationNewParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Endpoint: cloudflare.F("/api/v1/users/{var1}"), Host: cloudflare.F("www.example.com"), Method: cloudflare.F(api_gateway.OperationNewParamsMethodGet), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", operation.OperationID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "features": { "thresholds": { "auth_id_tokens": 0, "data_points": 0, "last_updated": "2014-01-01T05:20:00.12345Z", "p50": 0, "p90": 0, "p99": 0, "period_seconds": 0, "requests": 0, "suggested_threshold": 0 } } }, "success": true } ``` ## Delete an operation `client.APIGateway.Operations.Delete(ctx, operationID, body) (*OperationDeleteResponse, error)` **delete** `/zones/{zone_id}/api_gateway/operations/{operation_id}` Removes a single API operation from API Shield endpoint management. The operation will no longer be tracked or protected by API Shield rules. ### Parameters - `operationID string` UUID. - `body OperationDeleteParams` - `ZoneID param.Field[string]` Identifier. ### Returns - `type OperationDeleteResponse struct{…}` - `Errors Message` - `Code int64` - `Message string` - `DocumentationURL string` - `Source MessageItemSource` - `Pointer string` - `Messages Message` - `Success OperationDeleteResponseSuccess` Whether the API call was successful. - `const OperationDeleteResponseSuccessTrue OperationDeleteResponseSuccess = true` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) operation, err := client.APIGateway.Operations.Delete( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", api_gateway.OperationDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", operation.Errors) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true } ``` ## Add operations to a zone `client.APIGateway.Operations.BulkNew(ctx, params) (*SinglePage[OperationBulkNewResponse], error)` **post** `/zones/{zone_id}/api_gateway/operations` Add one or more operations to a zone. Endpoints can contain path variables. Host, method, endpoint will be normalized to a canoncial form when creating an operation and must be unique on the zone. Inserting an operation that matches an existing one will return the record of the already existing operation and update its last_updated date. ### Parameters - `params OperationBulkNewParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Body param.Field[[]OperationBulkNewParamsBody]` Body param - `Endpoint string` The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/. - `Host string` RFC3986-compliant host. - `Method OperationBulkNewParamsBodyMethod` The HTTP method used to access the endpoint. - `const OperationBulkNewParamsBodyMethodGet OperationBulkNewParamsBodyMethod = "GET"` - `const OperationBulkNewParamsBodyMethodPost OperationBulkNewParamsBodyMethod = "POST"` - `const OperationBulkNewParamsBodyMethodHead OperationBulkNewParamsBodyMethod = "HEAD"` - `const OperationBulkNewParamsBodyMethodOptions OperationBulkNewParamsBodyMethod = "OPTIONS"` - `const OperationBulkNewParamsBodyMethodPut OperationBulkNewParamsBodyMethod = "PUT"` - `const OperationBulkNewParamsBodyMethodDelete OperationBulkNewParamsBodyMethod = "DELETE"` - `const OperationBulkNewParamsBodyMethodConnect OperationBulkNewParamsBodyMethod = "CONNECT"` - `const OperationBulkNewParamsBodyMethodPatch OperationBulkNewParamsBodyMethod = "PATCH"` - `const OperationBulkNewParamsBodyMethodTrace OperationBulkNewParamsBodyMethod = "TRACE"` ### Returns - `type OperationBulkNewResponse struct{…}` - `Endpoint string` The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/. - `Host string` RFC3986-compliant host. - `LastUpdated Time` - `Method OperationBulkNewResponseMethod` The HTTP method used to access the endpoint. - `const OperationBulkNewResponseMethodGet OperationBulkNewResponseMethod = "GET"` - `const OperationBulkNewResponseMethodPost OperationBulkNewResponseMethod = "POST"` - `const OperationBulkNewResponseMethodHead OperationBulkNewResponseMethod = "HEAD"` - `const OperationBulkNewResponseMethodOptions OperationBulkNewResponseMethod = "OPTIONS"` - `const OperationBulkNewResponseMethodPut OperationBulkNewResponseMethod = "PUT"` - `const OperationBulkNewResponseMethodDelete OperationBulkNewResponseMethod = "DELETE"` - `const OperationBulkNewResponseMethodConnect OperationBulkNewResponseMethod = "CONNECT"` - `const OperationBulkNewResponseMethodPatch OperationBulkNewResponseMethod = "PATCH"` - `const OperationBulkNewResponseMethodTrace OperationBulkNewResponseMethod = "TRACE"` - `OperationID string` UUID. - `Features OperationBulkNewResponseFeatures` - `type OperationBulkNewResponseFeaturesAPIShieldOperationFeatureThresholds struct{…}` - `Thresholds OperationBulkNewResponseFeaturesAPIShieldOperationFeatureThresholdsThresholds` - `AuthIDTokens int64` The total number of auth-ids seen across this calculation. - `DataPoints int64` The number of data points used for the threshold suggestion calculation. - `LastUpdated Time` - `P50 int64` The p50 quantile of requests (in period_seconds). - `P90 int64` The p90 quantile of requests (in period_seconds). - `P99 int64` The p99 quantile of requests (in period_seconds). - `PeriodSeconds int64` The period over which this threshold is suggested. - `Requests int64` The estimated number of requests covered by these calculations. - `SuggestedThreshold int64` The suggested threshold in requests done by the same auth_id or period_seconds. - `type OperationBulkNewResponseFeaturesAPIShieldOperationFeatureParameterSchemas struct{…}` - `ParameterSchemas OperationBulkNewResponseFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas` - `LastUpdated Time` - `ParameterSchemas OperationBulkNewResponseFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas` An operation schema object containing a response. - `Parameters []unknown` An array containing the learned parameter schemas. - `Responses unknown` An empty response object. This field is required to yield a valid operation schema. - `type OperationBulkNewResponseFeaturesAPIShieldOperationFeatureAPIRouting struct{…}` - `APIRouting OperationBulkNewResponseFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting` API Routing settings on endpoint. - `LastUpdated Time` - `Route string` Target route. - `type OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervals struct{…}` - `ConfidenceIntervals OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals` - `LastUpdated Time` - `SuggestedThreshold OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold` - `ConfidenceIntervals OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals` - `P90 OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `P95 OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `P99 OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `Mean float64` Suggested threshold. - `type OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfo struct{…}` - `SchemaInfo OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo` - `ActiveSchema OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema` Schema active on endpoint. - `ID string` UUID. - `CreatedAt Time` - `IsLearned bool` True if schema is Cloudflare-provided. - `Name string` Schema file name. - `LearnedAvailable bool` True if a Cloudflare-provided learned schema is available for this endpoint. - `MitigationAction OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction` Action taken on requests failing validation. - `const OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionNone OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "none"` - `const OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionLog OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "log"` - `const OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionBlock OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "block"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.APIGateway.Operations.BulkNew(context.TODO(), api_gateway.OperationBulkNewParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: []api_gateway.OperationBulkNewParamsBody{api_gateway.OperationBulkNewParamsBody{ Endpoint: cloudflare.F("/api/v1/users/{var1}"), Host: cloudflare.F("www.example.com"), Method: cloudflare.F(api_gateway.OperationBulkNewParamsBodyMethodGet), }}, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "features": { "thresholds": { "auth_id_tokens": 0, "data_points": 0, "last_updated": "2014-01-01T05:20:00.12345Z", "p50": 0, "p90": 0, "p99": 0, "period_seconds": 0, "requests": 0, "suggested_threshold": 0 } } } ], "success": true } ``` ## Delete multiple operations `client.APIGateway.Operations.BulkDelete(ctx, body) (*OperationBulkDeleteResponse, error)` **delete** `/zones/{zone_id}/api_gateway/operations` Bulk removes multiple API operations from API Shield endpoint management in a single request. Efficient for cleaning up unused endpoints. ### Parameters - `body OperationBulkDeleteParams` - `ZoneID param.Field[string]` Identifier. ### Returns - `type OperationBulkDeleteResponse struct{…}` - `Errors Message` - `Code int64` - `Message string` - `DocumentationURL string` - `Source MessageItemSource` - `Pointer string` - `Messages Message` - `Success OperationBulkDeleteResponseSuccess` Whether the API call was successful. - `const OperationBulkDeleteResponseSuccessTrue OperationBulkDeleteResponseSuccess = true` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.APIGateway.Operations.BulkDelete(context.TODO(), api_gateway.OperationBulkDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Errors) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true } ``` ## Domain Types ### API Shield - `type APIShield struct{…}` - `Endpoint string` The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/. - `Host string` RFC3986-compliant host. - `LastUpdated Time` - `Method APIShieldMethod` The HTTP method used to access the endpoint. - `const APIShieldMethodGet APIShieldMethod = "GET"` - `const APIShieldMethodPost APIShieldMethod = "POST"` - `const APIShieldMethodHead APIShieldMethod = "HEAD"` - `const APIShieldMethodOptions APIShieldMethod = "OPTIONS"` - `const APIShieldMethodPut APIShieldMethod = "PUT"` - `const APIShieldMethodDelete APIShieldMethod = "DELETE"` - `const APIShieldMethodConnect APIShieldMethod = "CONNECT"` - `const APIShieldMethodPatch APIShieldMethod = "PATCH"` - `const APIShieldMethodTrace APIShieldMethod = "TRACE"` - `OperationID string` UUID. # Labels ## Replace label(s) on an operation in endpoint management `client.APIGateway.Operations.Labels.Update(ctx, operationID, params) (*OperationLabelUpdateResponse, error)` **put** `/zones/{zone_id}/api_gateway/operations/{operation_id}/labels` Replace label(s) on an operation in endpoint management ### Parameters - `operationID string` UUID. - `params OperationLabelUpdateParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Managed param.Field[[]string]` Body param: List of managed label names. Omitting this property or passing an empty array will result in all managed labels being removed from the operation - `User param.Field[[]string]` Body param: List of user label names. Omitting this property or passing an empty array will result in all user labels being removed from the operation ### Returns - `type OperationLabelUpdateResponse struct{…}` - `Endpoint string` The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/. - `Host string` RFC3986-compliant host. - `LastUpdated Time` - `Method OperationLabelUpdateResponseMethod` The HTTP method used to access the endpoint. - `const OperationLabelUpdateResponseMethodGet OperationLabelUpdateResponseMethod = "GET"` - `const OperationLabelUpdateResponseMethodPost OperationLabelUpdateResponseMethod = "POST"` - `const OperationLabelUpdateResponseMethodHead OperationLabelUpdateResponseMethod = "HEAD"` - `const OperationLabelUpdateResponseMethodOptions OperationLabelUpdateResponseMethod = "OPTIONS"` - `const OperationLabelUpdateResponseMethodPut OperationLabelUpdateResponseMethod = "PUT"` - `const OperationLabelUpdateResponseMethodDelete OperationLabelUpdateResponseMethod = "DELETE"` - `const OperationLabelUpdateResponseMethodConnect OperationLabelUpdateResponseMethod = "CONNECT"` - `const OperationLabelUpdateResponseMethodPatch OperationLabelUpdateResponseMethod = "PATCH"` - `const OperationLabelUpdateResponseMethodTrace OperationLabelUpdateResponseMethod = "TRACE"` - `OperationID string` UUID. - `Labels []OperationLabelUpdateResponseLabel` - `CreatedAt Time` - `Description string` The description of the label - `LastUpdated Time` - `Metadata unknown` Metadata for the label - `Name string` The name of the label - `Source OperationLabelUpdateResponseLabelsSource` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `const OperationLabelUpdateResponseLabelsSourceUser OperationLabelUpdateResponseLabelsSource = "user"` - `const OperationLabelUpdateResponseLabelsSourceManaged OperationLabelUpdateResponseLabelsSource = "managed"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) label, err := client.APIGateway.Operations.Labels.Update( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", api_gateway.OperationLabelUpdateParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", label.OperationID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "labels": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user" } ] }, "success": true } ``` ## Attach label(s) on an operation in endpoint management `client.APIGateway.Operations.Labels.New(ctx, operationID, params) (*OperationLabelNewResponse, error)` **post** `/zones/{zone_id}/api_gateway/operations/{operation_id}/labels` Attach label(s) on an operation in endpoint management ### Parameters - `operationID string` UUID. - `params OperationLabelNewParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Managed param.Field[[]string]` Body param: List of managed label names. - `User param.Field[[]string]` Body param: List of user label names. ### Returns - `type OperationLabelNewResponse struct{…}` - `Endpoint string` The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/. - `Host string` RFC3986-compliant host. - `LastUpdated Time` - `Method OperationLabelNewResponseMethod` The HTTP method used to access the endpoint. - `const OperationLabelNewResponseMethodGet OperationLabelNewResponseMethod = "GET"` - `const OperationLabelNewResponseMethodPost OperationLabelNewResponseMethod = "POST"` - `const OperationLabelNewResponseMethodHead OperationLabelNewResponseMethod = "HEAD"` - `const OperationLabelNewResponseMethodOptions OperationLabelNewResponseMethod = "OPTIONS"` - `const OperationLabelNewResponseMethodPut OperationLabelNewResponseMethod = "PUT"` - `const OperationLabelNewResponseMethodDelete OperationLabelNewResponseMethod = "DELETE"` - `const OperationLabelNewResponseMethodConnect OperationLabelNewResponseMethod = "CONNECT"` - `const OperationLabelNewResponseMethodPatch OperationLabelNewResponseMethod = "PATCH"` - `const OperationLabelNewResponseMethodTrace OperationLabelNewResponseMethod = "TRACE"` - `OperationID string` UUID. - `Labels []OperationLabelNewResponseLabel` - `CreatedAt Time` - `Description string` The description of the label - `LastUpdated Time` - `Metadata unknown` Metadata for the label - `Name string` The name of the label - `Source OperationLabelNewResponseLabelsSource` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `const OperationLabelNewResponseLabelsSourceUser OperationLabelNewResponseLabelsSource = "user"` - `const OperationLabelNewResponseLabelsSourceManaged OperationLabelNewResponseLabelsSource = "managed"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) label, err := client.APIGateway.Operations.Labels.New( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", api_gateway.OperationLabelNewParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", label.OperationID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "labels": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user" } ] }, "success": true } ``` ## Remove label(s) on an operation in endpoint management `client.APIGateway.Operations.Labels.Delete(ctx, operationID, body) (*OperationLabelDeleteResponse, error)` **delete** `/zones/{zone_id}/api_gateway/operations/{operation_id}/labels` Remove label(s) on an operation in endpoint management ### Parameters - `operationID string` UUID. - `body OperationLabelDeleteParams` - `ZoneID param.Field[string]` Identifier. ### Returns - `type OperationLabelDeleteResponse struct{…}` - `Endpoint string` The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/. - `Host string` RFC3986-compliant host. - `LastUpdated Time` - `Method OperationLabelDeleteResponseMethod` The HTTP method used to access the endpoint. - `const OperationLabelDeleteResponseMethodGet OperationLabelDeleteResponseMethod = "GET"` - `const OperationLabelDeleteResponseMethodPost OperationLabelDeleteResponseMethod = "POST"` - `const OperationLabelDeleteResponseMethodHead OperationLabelDeleteResponseMethod = "HEAD"` - `const OperationLabelDeleteResponseMethodOptions OperationLabelDeleteResponseMethod = "OPTIONS"` - `const OperationLabelDeleteResponseMethodPut OperationLabelDeleteResponseMethod = "PUT"` - `const OperationLabelDeleteResponseMethodDelete OperationLabelDeleteResponseMethod = "DELETE"` - `const OperationLabelDeleteResponseMethodConnect OperationLabelDeleteResponseMethod = "CONNECT"` - `const OperationLabelDeleteResponseMethodPatch OperationLabelDeleteResponseMethod = "PATCH"` - `const OperationLabelDeleteResponseMethodTrace OperationLabelDeleteResponseMethod = "TRACE"` - `OperationID string` UUID. - `Labels []OperationLabelDeleteResponseLabel` - `CreatedAt Time` - `Description string` The description of the label - `LastUpdated Time` - `Metadata unknown` Metadata for the label - `Name string` The name of the label - `Source OperationLabelDeleteResponseLabelsSource` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `const OperationLabelDeleteResponseLabelsSourceUser OperationLabelDeleteResponseLabelsSource = "user"` - `const OperationLabelDeleteResponseLabelsSourceManaged OperationLabelDeleteResponseLabelsSource = "managed"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) label, err := client.APIGateway.Operations.Labels.Delete( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", api_gateway.OperationLabelDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", label.OperationID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "labels": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user" } ] }, "success": true } ``` ## Bulk replace label(s) on operation(s) in endpoint management `client.APIGateway.Operations.Labels.BulkUpdate(ctx, params) (*SinglePage[OperationLabelBulkUpdateResponse], error)` **put** `/zones/{zone_id}/api_gateway/operations/labels` Bulk replace label(s) on operation(s) in endpoint management ### Parameters - `params OperationLabelBulkUpdateParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Managed param.Field[OperationLabelBulkUpdateParamsManaged]` Body param: Managed labels to replace for all affected operations - `Labels []string` List of managed label names. Providing an empty array will result in all managed labels being removed from all affected operations - `Selector param.Field[OperationLabelBulkUpdateParamsSelector]` Body param: Operation IDs selector - `Include OperationLabelBulkUpdateParamsSelectorInclude` - `OperationIDs []string` - `User param.Field[OperationLabelBulkUpdateParamsUser]` Body param: User labels to replace for all affected operations - `Labels []string` List of user label names. Providing an empty array will result in all user labels being removed from all affected operations ### Returns - `type OperationLabelBulkUpdateResponse struct{…}` - `Endpoint string` The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/. - `Host string` RFC3986-compliant host. - `LastUpdated Time` - `Method OperationLabelBulkUpdateResponseMethod` The HTTP method used to access the endpoint. - `const OperationLabelBulkUpdateResponseMethodGet OperationLabelBulkUpdateResponseMethod = "GET"` - `const OperationLabelBulkUpdateResponseMethodPost OperationLabelBulkUpdateResponseMethod = "POST"` - `const OperationLabelBulkUpdateResponseMethodHead OperationLabelBulkUpdateResponseMethod = "HEAD"` - `const OperationLabelBulkUpdateResponseMethodOptions OperationLabelBulkUpdateResponseMethod = "OPTIONS"` - `const OperationLabelBulkUpdateResponseMethodPut OperationLabelBulkUpdateResponseMethod = "PUT"` - `const OperationLabelBulkUpdateResponseMethodDelete OperationLabelBulkUpdateResponseMethod = "DELETE"` - `const OperationLabelBulkUpdateResponseMethodConnect OperationLabelBulkUpdateResponseMethod = "CONNECT"` - `const OperationLabelBulkUpdateResponseMethodPatch OperationLabelBulkUpdateResponseMethod = "PATCH"` - `const OperationLabelBulkUpdateResponseMethodTrace OperationLabelBulkUpdateResponseMethod = "TRACE"` - `OperationID string` UUID. - `Labels []OperationLabelBulkUpdateResponseLabel` - `CreatedAt Time` - `Description string` The description of the label - `LastUpdated Time` - `Metadata unknown` Metadata for the label - `Name string` The name of the label - `Source OperationLabelBulkUpdateResponseLabelsSource` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `const OperationLabelBulkUpdateResponseLabelsSourceUser OperationLabelBulkUpdateResponseLabelsSource = "user"` - `const OperationLabelBulkUpdateResponseLabelsSourceManaged OperationLabelBulkUpdateResponseLabelsSource = "managed"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.APIGateway.Operations.Labels.BulkUpdate(context.TODO(), api_gateway.OperationLabelBulkUpdateParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Managed: cloudflare.F(api_gateway.OperationLabelBulkUpdateParamsManaged{ Labels: cloudflare.F([]string{"login"}), }), Selector: cloudflare.F(api_gateway.OperationLabelBulkUpdateParamsSelector{ Include: cloudflare.F(api_gateway.OperationLabelBulkUpdateParamsSelectorInclude{ OperationIDs: cloudflare.F([]string{"f174e90a-fafe-4643-bbbc-4a0ed4fc8415"}), }), }), User: cloudflare.F(api_gateway.OperationLabelBulkUpdateParamsUser{ Labels: cloudflare.F([]string{"login"}), }), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "labels": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user" } ] } ], "success": true } ``` ## Bulk attach label(s) on operation(s) in endpoint management `client.APIGateway.Operations.Labels.BulkNew(ctx, params) (*SinglePage[OperationLabelBulkNewResponse], error)` **post** `/zones/{zone_id}/api_gateway/operations/labels` Bulk attach label(s) on operation(s) in endpoint management ### Parameters - `params OperationLabelBulkNewParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Selector param.Field[OperationLabelBulkNewParamsSelector]` Body param: Operation IDs selector - `Include OperationLabelBulkNewParamsSelectorInclude` - `OperationIDs []string` - `Managed param.Field[OperationLabelBulkNewParamsManaged]` Body param - `Labels []string` List of managed label names. - `User param.Field[OperationLabelBulkNewParamsUser]` Body param - `Labels []string` List of user label names. ### Returns - `type OperationLabelBulkNewResponse struct{…}` - `Endpoint string` The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/. - `Host string` RFC3986-compliant host. - `LastUpdated Time` - `Method OperationLabelBulkNewResponseMethod` The HTTP method used to access the endpoint. - `const OperationLabelBulkNewResponseMethodGet OperationLabelBulkNewResponseMethod = "GET"` - `const OperationLabelBulkNewResponseMethodPost OperationLabelBulkNewResponseMethod = "POST"` - `const OperationLabelBulkNewResponseMethodHead OperationLabelBulkNewResponseMethod = "HEAD"` - `const OperationLabelBulkNewResponseMethodOptions OperationLabelBulkNewResponseMethod = "OPTIONS"` - `const OperationLabelBulkNewResponseMethodPut OperationLabelBulkNewResponseMethod = "PUT"` - `const OperationLabelBulkNewResponseMethodDelete OperationLabelBulkNewResponseMethod = "DELETE"` - `const OperationLabelBulkNewResponseMethodConnect OperationLabelBulkNewResponseMethod = "CONNECT"` - `const OperationLabelBulkNewResponseMethodPatch OperationLabelBulkNewResponseMethod = "PATCH"` - `const OperationLabelBulkNewResponseMethodTrace OperationLabelBulkNewResponseMethod = "TRACE"` - `OperationID string` UUID. - `Labels []OperationLabelBulkNewResponseLabel` - `CreatedAt Time` - `Description string` The description of the label - `LastUpdated Time` - `Metadata unknown` Metadata for the label - `Name string` The name of the label - `Source OperationLabelBulkNewResponseLabelsSource` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `const OperationLabelBulkNewResponseLabelsSourceUser OperationLabelBulkNewResponseLabelsSource = "user"` - `const OperationLabelBulkNewResponseLabelsSourceManaged OperationLabelBulkNewResponseLabelsSource = "managed"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.APIGateway.Operations.Labels.BulkNew(context.TODO(), api_gateway.OperationLabelBulkNewParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Selector: cloudflare.F(api_gateway.OperationLabelBulkNewParamsSelector{ Include: cloudflare.F(api_gateway.OperationLabelBulkNewParamsSelectorInclude{ OperationIDs: cloudflare.F([]string{"f174e90a-fafe-4643-bbbc-4a0ed4fc8415"}), }), }), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "labels": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user" } ] } ], "success": true } ``` ## Bulk remove label(s) on operation(s) in endpoint management `client.APIGateway.Operations.Labels.BulkDelete(ctx, body) (*SinglePage[OperationLabelBulkDeleteResponse], error)` **delete** `/zones/{zone_id}/api_gateway/operations/labels` Bulk remove label(s) on operation(s) in endpoint management ### Parameters - `body OperationLabelBulkDeleteParams` - `ZoneID param.Field[string]` Identifier. ### Returns - `type OperationLabelBulkDeleteResponse struct{…}` - `Endpoint string` The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/. - `Host string` RFC3986-compliant host. - `LastUpdated Time` - `Method OperationLabelBulkDeleteResponseMethod` The HTTP method used to access the endpoint. - `const OperationLabelBulkDeleteResponseMethodGet OperationLabelBulkDeleteResponseMethod = "GET"` - `const OperationLabelBulkDeleteResponseMethodPost OperationLabelBulkDeleteResponseMethod = "POST"` - `const OperationLabelBulkDeleteResponseMethodHead OperationLabelBulkDeleteResponseMethod = "HEAD"` - `const OperationLabelBulkDeleteResponseMethodOptions OperationLabelBulkDeleteResponseMethod = "OPTIONS"` - `const OperationLabelBulkDeleteResponseMethodPut OperationLabelBulkDeleteResponseMethod = "PUT"` - `const OperationLabelBulkDeleteResponseMethodDelete OperationLabelBulkDeleteResponseMethod = "DELETE"` - `const OperationLabelBulkDeleteResponseMethodConnect OperationLabelBulkDeleteResponseMethod = "CONNECT"` - `const OperationLabelBulkDeleteResponseMethodPatch OperationLabelBulkDeleteResponseMethod = "PATCH"` - `const OperationLabelBulkDeleteResponseMethodTrace OperationLabelBulkDeleteResponseMethod = "TRACE"` - `OperationID string` UUID. - `Labels []OperationLabelBulkDeleteResponseLabel` - `CreatedAt Time` - `Description string` The description of the label - `LastUpdated Time` - `Metadata unknown` Metadata for the label - `Name string` The name of the label - `Source OperationLabelBulkDeleteResponseLabelsSource` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `const OperationLabelBulkDeleteResponseLabelsSourceUser OperationLabelBulkDeleteResponseLabelsSource = "user"` - `const OperationLabelBulkDeleteResponseLabelsSourceManaged OperationLabelBulkDeleteResponseLabelsSource = "managed"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.APIGateway.Operations.Labels.BulkDelete(context.TODO(), api_gateway.OperationLabelBulkDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "labels": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user" } ] } ], "success": true } ``` # Schema Validation ## Retrieve operation-level schema validation settings `client.APIGateway.Operations.SchemaValidation.Get(ctx, operationID, query) (*OperationSchemaValidationGetResponse, error)` **get** `/zones/{zone_id}/api_gateway/operations/{operation_id}/schema_validation` Retrieves operation-level schema validation settings on the zone ### Parameters - `operationID string` UUID. - `query OperationSchemaValidationGetParams` - `ZoneID param.Field[string]` Identifier. ### Returns - `type OperationSchemaValidationGetResponse struct{…}` - `MitigationAction OperationSchemaValidationGetResponseMitigationAction` When set, this applies a mitigation action to this operation - `log` log request when request does not conform to schema for this operation - `block` deny access to the site when request does not conform to schema for this operation - `none` will skip mitigation for this operation - `null` indicates that no operation level mitigation is in place, see Zone Level Schema Validation Settings for mitigation action that will be applied - `const OperationSchemaValidationGetResponseMitigationActionLog OperationSchemaValidationGetResponseMitigationAction = "log"` - `const OperationSchemaValidationGetResponseMitigationActionBlock OperationSchemaValidationGetResponseMitigationAction = "block"` - `const OperationSchemaValidationGetResponseMitigationActionNone OperationSchemaValidationGetResponseMitigationAction = "none"` - `OperationID string` UUID. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) schemaValidation, err := client.APIGateway.Operations.SchemaValidation.Get( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", api_gateway.OperationSchemaValidationGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", schemaValidation.OperationID) } ``` #### Response ```json { "mitigation_action": "block", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ``` ## Update operation-level schema validation settings `client.APIGateway.Operations.SchemaValidation.Update(ctx, operationID, params) (*OperationSchemaValidationUpdateResponse, error)` **put** `/zones/{zone_id}/api_gateway/operations/{operation_id}/schema_validation` Updates operation-level schema validation settings on the zone ### Parameters - `operationID string` UUID. - `params OperationSchemaValidationUpdateParams` - `ZoneID param.Field[string]` Path param: Identifier. - `MitigationAction param.Field[OperationSchemaValidationUpdateParamsMitigationAction]` Body param: When set, this applies a mitigation action to this operation - `log` log request when request does not conform to schema for this operation - `block` deny access to the site when request does not conform to schema for this operation - `none` will skip mitigation for this operation - `null` indicates that no operation level mitigation is in place, see Zone Level Schema Validation Settings for mitigation action that will be applied - `const OperationSchemaValidationUpdateParamsMitigationActionLog OperationSchemaValidationUpdateParamsMitigationAction = "log"` - `const OperationSchemaValidationUpdateParamsMitigationActionBlock OperationSchemaValidationUpdateParamsMitigationAction = "block"` - `const OperationSchemaValidationUpdateParamsMitigationActionNone OperationSchemaValidationUpdateParamsMitigationAction = "none"` ### Returns - `type OperationSchemaValidationUpdateResponse struct{…}` - `MitigationAction OperationSchemaValidationUpdateResponseMitigationAction` When set, this applies a mitigation action to this operation - `log` log request when request does not conform to schema for this operation - `block` deny access to the site when request does not conform to schema for this operation - `none` will skip mitigation for this operation - `null` indicates that no operation level mitigation is in place, see Zone Level Schema Validation Settings for mitigation action that will be applied - `const OperationSchemaValidationUpdateResponseMitigationActionLog OperationSchemaValidationUpdateResponseMitigationAction = "log"` - `const OperationSchemaValidationUpdateResponseMitigationActionBlock OperationSchemaValidationUpdateResponseMitigationAction = "block"` - `const OperationSchemaValidationUpdateResponseMitigationActionNone OperationSchemaValidationUpdateResponseMitigationAction = "none"` - `OperationID string` UUID. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) schemaValidation, err := client.APIGateway.Operations.SchemaValidation.Update( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", api_gateway.OperationSchemaValidationUpdateParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", schemaValidation.OperationID) } ``` #### Response ```json { "mitigation_action": "block", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ``` ## Update multiple operation-level schema validation settings `client.APIGateway.Operations.SchemaValidation.Edit(ctx, params) (*SettingsMultipleRequest, error)` **patch** `/zones/{zone_id}/api_gateway/operations/schema_validation` Updates multiple operation-level schema validation settings on the zone ### Parameters - `params OperationSchemaValidationEditParams` - `ZoneID param.Field[string]` Path param: Identifier. - `SettingsMultipleRequest param.Field[SettingsMultipleRequest]` Body param ### Returns - `type SettingsMultipleRequest map[string, SettingsMultipleRequestItem]` - `MitigationAction SettingsMultipleRequestItemMitigationAction` When set, this applies a mitigation action to this operation - `log` log request when request does not conform to schema for this operation - `block` deny access to the site when request does not conform to schema for this operation - `none` will skip mitigation for this operation - `null` indicates that no operation level mitigation is in place, see Zone Level Schema Validation Settings for mitigation action that will be applied - `const SettingsMultipleRequestItemMitigationActionLog SettingsMultipleRequestItemMitigationAction = "log"` - `const SettingsMultipleRequestItemMitigationActionBlock SettingsMultipleRequestItemMitigationAction = "block"` - `const SettingsMultipleRequestItemMitigationActionNone SettingsMultipleRequestItemMitigationAction = "none"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/api_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) settingsMultipleRequest, err := client.APIGateway.Operations.SchemaValidation.Edit(context.TODO(), api_gateway.OperationSchemaValidationEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), SettingsMultipleRequest: api_gateway.SettingsMultipleRequestParam{ "3818d821-5901-4147-a474-f5f5aec1d54e": api_gateway.SettingsMultipleRequestItemParam{ }, "b17c8043-99a0-4202-b7d9-8f7cdbee02cd": api_gateway.SettingsMultipleRequestItemParam{ }, }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", settingsMultipleRequest) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "3818d821-5901-4147-a474-f5f5aec1d54e": { "mitigation_action": "log" }, "b17c8043-99a0-4202-b7d9-8f7cdbee02cd": { "mitigation_action": "block" } }, "success": true } ``` ## Domain Types ### Settings Multiple Request - `type SettingsMultipleRequest map[string, SettingsMultipleRequestItem]` - `MitigationAction SettingsMultipleRequestItemMitigationAction` When set, this applies a mitigation action to this operation - `log` log request when request does not conform to schema for this operation - `block` deny access to the site when request does not conform to schema for this operation - `none` will skip mitigation for this operation - `null` indicates that no operation level mitigation is in place, see Zone Level Schema Validation Settings for mitigation action that will be applied - `const SettingsMultipleRequestItemMitigationActionLog SettingsMultipleRequestItemMitigationAction = "log"` - `const SettingsMultipleRequestItemMitigationActionBlock SettingsMultipleRequestItemMitigationAction = "block"` - `const SettingsMultipleRequestItemMitigationActionNone SettingsMultipleRequestItemMitigationAction = "none"`