## Update a Gateway `client.AIGateway.Update(ctx, id, params) (*AIGatewayUpdateResponse, error)` **put** `/accounts/{account_id}/ai-gateway/gateways/{id}` Updates an existing AI Gateway dataset. ### Parameters - `id string` gateway id - `params AIGatewayUpdateParams` - `AccountID param.Field[string]` Path param - `CacheInvalidateOnUpdate param.Field[bool]` Body param - `CacheTTL param.Field[int64]` Body param - `CollectLogs param.Field[bool]` Body param - `RateLimitingInterval param.Field[int64]` Body param - `RateLimitingLimit param.Field[int64]` Body param - `Authentication param.Field[bool]` Body param - `DLP param.Field[AIGatewayUpdateParamsDLP]` Body param - `type AIGatewayUpdateParamsDLPObject struct{…}` - `Action AIGatewayUpdateParamsDLPObjectAction` - `const AIGatewayUpdateParamsDLPObjectActionBlock AIGatewayUpdateParamsDLPObjectAction = "BLOCK"` - `const AIGatewayUpdateParamsDLPObjectActionFlag AIGatewayUpdateParamsDLPObjectAction = "FLAG"` - `Enabled bool` - `Profiles []string` - `type AIGatewayUpdateParamsDLPObject struct{…}` - `Enabled bool` - `Policies []AIGatewayUpdateParamsDLPObjectPolicy` - `ID string` - `Action AIGatewayUpdateParamsDLPObjectPoliciesAction` - `const AIGatewayUpdateParamsDLPObjectPoliciesActionFlag AIGatewayUpdateParamsDLPObjectPoliciesAction = "FLAG"` - `const AIGatewayUpdateParamsDLPObjectPoliciesActionBlock AIGatewayUpdateParamsDLPObjectPoliciesAction = "BLOCK"` - `Check []AIGatewayUpdateParamsDLPObjectPoliciesCheck` - `const AIGatewayUpdateParamsDLPObjectPoliciesCheckRequest AIGatewayUpdateParamsDLPObjectPoliciesCheck = "REQUEST"` - `const AIGatewayUpdateParamsDLPObjectPoliciesCheckResponse AIGatewayUpdateParamsDLPObjectPoliciesCheck = "RESPONSE"` - `Enabled bool` - `Profiles []string` - `LogManagement param.Field[int64]` Body param - `LogManagementStrategy param.Field[AIGatewayUpdateParamsLogManagementStrategy]` Body param - `const AIGatewayUpdateParamsLogManagementStrategyStopInserting AIGatewayUpdateParamsLogManagementStrategy = "STOP_INSERTING"` - `const AIGatewayUpdateParamsLogManagementStrategyDeleteOldest AIGatewayUpdateParamsLogManagementStrategy = "DELETE_OLDEST"` - `Logpush param.Field[bool]` Body param - `LogpushPublicKey param.Field[string]` Body param - `Otel param.Field[[]AIGatewayUpdateParamsOtel]` Body param - `Authorization string` - `Headers map[string, string]` - `URL string` - `ContentType AIGatewayUpdateParamsOtelContentType` - `const AIGatewayUpdateParamsOtelContentTypeJson AIGatewayUpdateParamsOtelContentType = "json"` - `const AIGatewayUpdateParamsOtelContentTypeProtobuf AIGatewayUpdateParamsOtelContentType = "protobuf"` - `RateLimitingTechnique param.Field[AIGatewayUpdateParamsRateLimitingTechnique]` Body param - `const AIGatewayUpdateParamsRateLimitingTechniqueFixed AIGatewayUpdateParamsRateLimitingTechnique = "fixed"` - `const AIGatewayUpdateParamsRateLimitingTechniqueSliding AIGatewayUpdateParamsRateLimitingTechnique = "sliding"` - `RetryBackoff param.Field[AIGatewayUpdateParamsRetryBackoff]` Body param: Backoff strategy for retry delays - `const AIGatewayUpdateParamsRetryBackoffConstant AIGatewayUpdateParamsRetryBackoff = "constant"` - `const AIGatewayUpdateParamsRetryBackoffLinear AIGatewayUpdateParamsRetryBackoff = "linear"` - `const AIGatewayUpdateParamsRetryBackoffExponential AIGatewayUpdateParamsRetryBackoff = "exponential"` - `RetryDelay param.Field[int64]` Body param: Delay between retry attempts in milliseconds (0-5000) - `RetryMaxAttempts param.Field[int64]` Body param: Maximum number of retry attempts for failed requests (1-5) - `StoreID param.Field[string]` Body param - `Stripe param.Field[AIGatewayUpdateParamsStripe]` Body param - `Authorization string` - `UsageEvents []AIGatewayUpdateParamsStripeUsageEvent` - `Payload string` - `WorkersAIBillingMode param.Field[AIGatewayUpdateParamsWorkersAIBillingMode]` Body param: Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `const AIGatewayUpdateParamsWorkersAIBillingModePostpaid AIGatewayUpdateParamsWorkersAIBillingMode = "postpaid"` - `Zdr param.Field[bool]` Body param ### Returns - `type AIGatewayUpdateResponse struct{…}` - `ID string` gateway id - `CacheInvalidateOnUpdate bool` - `CacheTTL int64` - `CollectLogs bool` - `CreatedAt Time` - `ModifiedAt Time` - `RateLimitingInterval int64` - `RateLimitingLimit int64` - `Authentication bool` - `DLP AIGatewayUpdateResponseDLP` - `type AIGatewayUpdateResponseDLPObject struct{…}` - `Action AIGatewayUpdateResponseDLPObjectAction` - `const AIGatewayUpdateResponseDLPObjectActionBlock AIGatewayUpdateResponseDLPObjectAction = "BLOCK"` - `const AIGatewayUpdateResponseDLPObjectActionFlag AIGatewayUpdateResponseDLPObjectAction = "FLAG"` - `Enabled bool` - `Profiles []string` - `type AIGatewayUpdateResponseDLPObject struct{…}` - `Enabled bool` - `Policies []AIGatewayUpdateResponseDLPObjectPolicy` - `ID string` - `Action AIGatewayUpdateResponseDLPObjectPoliciesAction` - `const AIGatewayUpdateResponseDLPObjectPoliciesActionFlag AIGatewayUpdateResponseDLPObjectPoliciesAction = "FLAG"` - `const AIGatewayUpdateResponseDLPObjectPoliciesActionBlock AIGatewayUpdateResponseDLPObjectPoliciesAction = "BLOCK"` - `Check []AIGatewayUpdateResponseDLPObjectPoliciesCheck` - `const AIGatewayUpdateResponseDLPObjectPoliciesCheckRequest AIGatewayUpdateResponseDLPObjectPoliciesCheck = "REQUEST"` - `const AIGatewayUpdateResponseDLPObjectPoliciesCheckResponse AIGatewayUpdateResponseDLPObjectPoliciesCheck = "RESPONSE"` - `Enabled bool` - `Profiles []string` - `IsDefault bool` - `LogManagement int64` - `LogManagementStrategy AIGatewayUpdateResponseLogManagementStrategy` - `const AIGatewayUpdateResponseLogManagementStrategyStopInserting AIGatewayUpdateResponseLogManagementStrategy = "STOP_INSERTING"` - `const AIGatewayUpdateResponseLogManagementStrategyDeleteOldest AIGatewayUpdateResponseLogManagementStrategy = "DELETE_OLDEST"` - `Logpush bool` - `LogpushPublicKey string` - `Otel []AIGatewayUpdateResponseOtel` - `Authorization string` - `Headers map[string, string]` - `URL string` - `ContentType AIGatewayUpdateResponseOtelContentType` - `const AIGatewayUpdateResponseOtelContentTypeJson AIGatewayUpdateResponseOtelContentType = "json"` - `const AIGatewayUpdateResponseOtelContentTypeProtobuf AIGatewayUpdateResponseOtelContentType = "protobuf"` - `RateLimitingTechnique AIGatewayUpdateResponseRateLimitingTechnique` - `const AIGatewayUpdateResponseRateLimitingTechniqueFixed AIGatewayUpdateResponseRateLimitingTechnique = "fixed"` - `const AIGatewayUpdateResponseRateLimitingTechniqueSliding AIGatewayUpdateResponseRateLimitingTechnique = "sliding"` - `RetryBackoff AIGatewayUpdateResponseRetryBackoff` Backoff strategy for retry delays - `const AIGatewayUpdateResponseRetryBackoffConstant AIGatewayUpdateResponseRetryBackoff = "constant"` - `const AIGatewayUpdateResponseRetryBackoffLinear AIGatewayUpdateResponseRetryBackoff = "linear"` - `const AIGatewayUpdateResponseRetryBackoffExponential AIGatewayUpdateResponseRetryBackoff = "exponential"` - `RetryDelay int64` Delay between retry attempts in milliseconds (0-5000) - `RetryMaxAttempts int64` Maximum number of retry attempts for failed requests (1-5) - `StoreID string` - `Stripe AIGatewayUpdateResponseStripe` - `Authorization string` - `UsageEvents []AIGatewayUpdateResponseStripeUsageEvent` - `Payload string` - `WorkersAIBillingMode AIGatewayUpdateResponseWorkersAIBillingMode` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `const AIGatewayUpdateResponseWorkersAIBillingModePostpaid AIGatewayUpdateResponseWorkersAIBillingMode = "postpaid"` - `Zdr bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) aiGateway, err := client.AIGateway.Update( context.TODO(), "my-gateway", ai_gateway.AIGatewayUpdateParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), CacheInvalidateOnUpdate: cloudflare.F(true), CacheTTL: cloudflare.F(int64(0)), CollectLogs: cloudflare.F(true), RateLimitingInterval: cloudflare.F(int64(0)), RateLimitingLimit: cloudflare.F(int64(0)), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", aiGateway.ID) } ``` #### Response ```json { "result": { "id": "my-gateway", "cache_invalidate_on_update": true, "cache_ttl": 0, "collect_logs": true, "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "rate_limiting_interval": 0, "rate_limiting_limit": 0, "authentication": true, "dlp": { "action": "BLOCK", "enabled": true, "profiles": [ "string" ] }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "authorization": "authorization", "headers": { "foo": "string" }, "url": "url", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "store_id": "store_id", "stripe": { "authorization": "authorization", "usage_events": [ { "payload": "payload" } ] }, "workers_ai_billing_mode": "postpaid", "zdr": true }, "success": true } ```