# Dynamic Routing ## List all AI Gateway Dynamic Routes. `client.AIGateway.DynamicRouting.List(ctx, gatewayID, query) (*DynamicRoutingListResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes` List all AI Gateway Dynamic Routes. ### Parameters - `gatewayID string` - `query DynamicRoutingListParams` - `AccountID param.Field[string]` ### Returns - `type DynamicRoutingListResponse struct{…}` - `Data DynamicRoutingListResponseData` - `OrderBy string` - `OrderByDirection string` - `Page float64` - `PerPage float64` - `Routes []DynamicRoutingListResponseDataRoute` - `ID string` - `AccountTag string` - `CreatedAt Time` - `Deployment DynamicRoutingListResponseDataRoutesDeployment` - `CreatedAt string` - `DeploymentID string` - `VersionID string` - `Elements []DynamicRoutingListResponseDataRoutesElement` - `type DynamicRoutingListResponseDataRoutesElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingListResponseDataRoutesElementsObjectOutputs` - `Next DynamicRoutingListResponseDataRoutesElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingListResponseDataRoutesElementsObjectType` - `const DynamicRoutingListResponseDataRoutesElementsObjectTypeStart DynamicRoutingListResponseDataRoutesElementsObjectType = "start"` - `type DynamicRoutingListResponseDataRoutesElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingListResponseDataRoutesElementsObjectOutputs` - `False DynamicRoutingListResponseDataRoutesElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingListResponseDataRoutesElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingListResponseDataRoutesElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingListResponseDataRoutesElementsObjectType` - `const DynamicRoutingListResponseDataRoutesElementsObjectTypeConditional DynamicRoutingListResponseDataRoutesElementsObjectType = "conditional"` - `type DynamicRoutingListResponseDataRoutesElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingListResponseDataRoutesElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingListResponseDataRoutesElementsObjectType` - `const DynamicRoutingListResponseDataRoutesElementsObjectTypePercentage DynamicRoutingListResponseDataRoutesElementsObjectType = "percentage"` - `type DynamicRoutingListResponseDataRoutesElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingListResponseDataRoutesElementsObjectOutputs` - `Fallback DynamicRoutingListResponseDataRoutesElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingListResponseDataRoutesElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingListResponseDataRoutesElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingListResponseDataRoutesElementsObjectPropertiesLimitType` - `const DynamicRoutingListResponseDataRoutesElementsObjectPropertiesLimitTypeCount DynamicRoutingListResponseDataRoutesElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingListResponseDataRoutesElementsObjectPropertiesLimitTypeCost DynamicRoutingListResponseDataRoutesElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingListResponseDataRoutesElementsObjectType` - `const DynamicRoutingListResponseDataRoutesElementsObjectTypeRate DynamicRoutingListResponseDataRoutesElementsObjectType = "rate"` - `type DynamicRoutingListResponseDataRoutesElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingListResponseDataRoutesElementsObjectOutputs` - `Fallback DynamicRoutingListResponseDataRoutesElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingListResponseDataRoutesElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingListResponseDataRoutesElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingListResponseDataRoutesElementsObjectType` - `const DynamicRoutingListResponseDataRoutesElementsObjectTypeModel DynamicRoutingListResponseDataRoutesElementsObjectType = "model"` - `type DynamicRoutingListResponseDataRoutesElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingListResponseDataRoutesElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingListResponseDataRoutesElementsObjectType` - `const DynamicRoutingListResponseDataRoutesElementsObjectTypeEnd DynamicRoutingListResponseDataRoutesElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` - `Version DynamicRoutingListResponseDataRoutesVersion` - `Active DynamicRoutingListResponseDataRoutesVersionActive` - `const DynamicRoutingListResponseDataRoutesVersionActiveTrue DynamicRoutingListResponseDataRoutesVersionActive = "true"` - `const DynamicRoutingListResponseDataRoutesVersionActiveFalse DynamicRoutingListResponseDataRoutesVersionActive = "false"` - `CreatedAt string` - `Data string` - `VersionID string` - `Success 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"), ) dynamicRoutings, err := client.AIGateway.DynamicRouting.List( context.TODO(), "54442216", ai_gateway.DynamicRoutingListParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dynamicRoutings.Data) } ``` #### Response ```json { "data": { "order_by": "order_by", "order_by_direction": "order_by_direction", "page": 0, "per_page": 0, "routes": [ { "id": "id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } } ] }, "success": true } ``` ## Get an AI Gateway Dynamic Route. `client.AIGateway.DynamicRouting.Get(ctx, gatewayID, id, query) (*DynamicRoutingGetResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Get an AI Gateway Dynamic Route. ### Parameters - `gatewayID string` - `id string` - `query DynamicRoutingGetParams` - `AccountID param.Field[string]` ### Returns - `type DynamicRoutingGetResponse struct{…}` - `ID string` - `CreatedAt Time` - `Deployment DynamicRoutingGetResponseDeployment` - `CreatedAt string` - `DeploymentID string` - `VersionID string` - `Elements []DynamicRoutingGetResponseElement` - `type DynamicRoutingGetResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetResponseElementsObjectOutputs` - `Next DynamicRoutingGetResponseElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingGetResponseElementsObjectType` - `const DynamicRoutingGetResponseElementsObjectTypeStart DynamicRoutingGetResponseElementsObjectType = "start"` - `type DynamicRoutingGetResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetResponseElementsObjectOutputs` - `False DynamicRoutingGetResponseElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingGetResponseElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingGetResponseElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingGetResponseElementsObjectType` - `const DynamicRoutingGetResponseElementsObjectTypeConditional DynamicRoutingGetResponseElementsObjectType = "conditional"` - `type DynamicRoutingGetResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingGetResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingGetResponseElementsObjectType` - `const DynamicRoutingGetResponseElementsObjectTypePercentage DynamicRoutingGetResponseElementsObjectType = "percentage"` - `type DynamicRoutingGetResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetResponseElementsObjectOutputs` - `Fallback DynamicRoutingGetResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingGetResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingGetResponseElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingGetResponseElementsObjectPropertiesLimitType` - `const DynamicRoutingGetResponseElementsObjectPropertiesLimitTypeCount DynamicRoutingGetResponseElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingGetResponseElementsObjectPropertiesLimitTypeCost DynamicRoutingGetResponseElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingGetResponseElementsObjectType` - `const DynamicRoutingGetResponseElementsObjectTypeRate DynamicRoutingGetResponseElementsObjectType = "rate"` - `type DynamicRoutingGetResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetResponseElementsObjectOutputs` - `Fallback DynamicRoutingGetResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingGetResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingGetResponseElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingGetResponseElementsObjectType` - `const DynamicRoutingGetResponseElementsObjectTypeModel DynamicRoutingGetResponseElementsObjectType = "model"` - `type DynamicRoutingGetResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingGetResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingGetResponseElementsObjectType` - `const DynamicRoutingGetResponseElementsObjectTypeEnd DynamicRoutingGetResponseElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` - `Version DynamicRoutingGetResponseVersion` - `Active DynamicRoutingGetResponseVersionActive` - `const DynamicRoutingGetResponseVersionActiveTrue DynamicRoutingGetResponseVersionActive = "true"` - `const DynamicRoutingGetResponseVersionActiveFalse DynamicRoutingGetResponseVersionActive = "false"` - `CreatedAt string` - `Data string` - `VersionID string` ### 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"), ) dynamicRouting, err := client.AIGateway.DynamicRouting.Get( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingGetParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dynamicRouting.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } }, "success": true } ``` ## Create a new AI Gateway Dynamic Route. `client.AIGateway.DynamicRouting.New(ctx, gatewayID, params) (*DynamicRoutingNewResponse, error)` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes` Create a new AI Gateway Dynamic Route. ### Parameters - `gatewayID string` - `params DynamicRoutingNewParams` - `AccountID param.Field[string]` Path param - `Elements param.Field[[]DynamicRoutingNewParamsElement]` Body param - `type DynamicRoutingNewParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewParamsElementsObjectOutputs` - `Next DynamicRoutingNewParamsElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingNewParamsElementsObjectType` - `const DynamicRoutingNewParamsElementsObjectTypeStart DynamicRoutingNewParamsElementsObjectType = "start"` - `type DynamicRoutingNewParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewParamsElementsObjectOutputs` - `False DynamicRoutingNewParamsElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingNewParamsElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingNewParamsElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingNewParamsElementsObjectType` - `const DynamicRoutingNewParamsElementsObjectTypeConditional DynamicRoutingNewParamsElementsObjectType = "conditional"` - `type DynamicRoutingNewParamsElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewParamsElementsObjectOutputs]` - `ElementID string` - `Type DynamicRoutingNewParamsElementsObjectType` - `const DynamicRoutingNewParamsElementsObjectTypePercentage DynamicRoutingNewParamsElementsObjectType = "percentage"` - `type DynamicRoutingNewParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewParamsElementsObjectOutputs` - `Fallback DynamicRoutingNewParamsElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewParamsElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewParamsElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingNewParamsElementsObjectPropertiesLimitType` - `const DynamicRoutingNewParamsElementsObjectPropertiesLimitTypeCount DynamicRoutingNewParamsElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingNewParamsElementsObjectPropertiesLimitTypeCost DynamicRoutingNewParamsElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingNewParamsElementsObjectType` - `const DynamicRoutingNewParamsElementsObjectTypeRate DynamicRoutingNewParamsElementsObjectType = "rate"` - `type DynamicRoutingNewParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewParamsElementsObjectOutputs` - `Fallback DynamicRoutingNewParamsElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewParamsElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewParamsElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingNewParamsElementsObjectType` - `const DynamicRoutingNewParamsElementsObjectTypeModel DynamicRoutingNewParamsElementsObjectType = "model"` - `type DynamicRoutingNewParamsElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewParamsElementsObjectOutputs]` - `ElementID string` - `Type DynamicRoutingNewParamsElementsObjectType` - `const DynamicRoutingNewParamsElementsObjectTypeEnd DynamicRoutingNewParamsElementsObjectType = "end"` - `Name param.Field[string]` Body param ### Returns - `type DynamicRoutingNewResponse struct{…}` - `ID string` - `CreatedAt Time` - `Deployment DynamicRoutingNewResponseDeployment` - `CreatedAt string` - `DeploymentID string` - `VersionID string` - `Elements []DynamicRoutingNewResponseElement` - `type DynamicRoutingNewResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewResponseElementsObjectOutputs` - `Next DynamicRoutingNewResponseElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingNewResponseElementsObjectType` - `const DynamicRoutingNewResponseElementsObjectTypeStart DynamicRoutingNewResponseElementsObjectType = "start"` - `type DynamicRoutingNewResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewResponseElementsObjectOutputs` - `False DynamicRoutingNewResponseElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingNewResponseElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingNewResponseElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingNewResponseElementsObjectType` - `const DynamicRoutingNewResponseElementsObjectTypeConditional DynamicRoutingNewResponseElementsObjectType = "conditional"` - `type DynamicRoutingNewResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingNewResponseElementsObjectType` - `const DynamicRoutingNewResponseElementsObjectTypePercentage DynamicRoutingNewResponseElementsObjectType = "percentage"` - `type DynamicRoutingNewResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewResponseElementsObjectOutputs` - `Fallback DynamicRoutingNewResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewResponseElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingNewResponseElementsObjectPropertiesLimitType` - `const DynamicRoutingNewResponseElementsObjectPropertiesLimitTypeCount DynamicRoutingNewResponseElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingNewResponseElementsObjectPropertiesLimitTypeCost DynamicRoutingNewResponseElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingNewResponseElementsObjectType` - `const DynamicRoutingNewResponseElementsObjectTypeRate DynamicRoutingNewResponseElementsObjectType = "rate"` - `type DynamicRoutingNewResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewResponseElementsObjectOutputs` - `Fallback DynamicRoutingNewResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewResponseElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingNewResponseElementsObjectType` - `const DynamicRoutingNewResponseElementsObjectTypeModel DynamicRoutingNewResponseElementsObjectType = "model"` - `type DynamicRoutingNewResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingNewResponseElementsObjectType` - `const DynamicRoutingNewResponseElementsObjectTypeEnd DynamicRoutingNewResponseElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` - `Version DynamicRoutingNewResponseVersion` - `Active DynamicRoutingNewResponseVersionActive` - `const DynamicRoutingNewResponseVersionActiveTrue DynamicRoutingNewResponseVersionActive = "true"` - `const DynamicRoutingNewResponseVersionActiveFalse DynamicRoutingNewResponseVersionActive = "false"` - `CreatedAt string` - `Data string` - `VersionID string` ### 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"), ) dynamicRouting, err := client.AIGateway.DynamicRouting.New( context.TODO(), "54442216", ai_gateway.DynamicRoutingNewParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), Elements: cloudflare.F([]ai_gateway.DynamicRoutingNewParamsElementUnion{ai_gateway.DynamicRoutingNewParamsElementsObject{ ID: cloudflare.F("id"), Outputs: cloudflare.F(ai_gateway.DynamicRoutingNewParamsElementsObjectOutputs{ Next: cloudflare.F(ai_gateway.DynamicRoutingNewParamsElementsObjectOutputsNext{ ElementID: cloudflare.F("elementId"), }), }), Type: cloudflare.F(ai_gateway.DynamicRoutingNewParamsElementsObjectTypeStart), }}), Name: cloudflare.F("name"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dynamicRouting.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } }, "success": true } ``` ## Update an AI Gateway Dynamic Route. `client.AIGateway.DynamicRouting.Update(ctx, gatewayID, id, params) (*DynamicRoutingUpdateResponse, error)` **patch** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Update an AI Gateway Dynamic Route. ### Parameters - `gatewayID string` - `id string` - `params DynamicRoutingUpdateParams` - `AccountID param.Field[string]` Path param - `Name param.Field[string]` Body param ### Returns - `type DynamicRoutingUpdateResponse struct{…}` - `Route DynamicRoutingUpdateResponseRoute` - `ID string` - `AccountTag string` - `CreatedAt Time` - `Deployment DynamicRoutingUpdateResponseRouteDeployment` - `CreatedAt string` - `DeploymentID string` - `VersionID string` - `Elements []DynamicRoutingUpdateResponseRouteElement` - `type DynamicRoutingUpdateResponseRouteElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingUpdateResponseRouteElementsObjectOutputs` - `Next DynamicRoutingUpdateResponseRouteElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingUpdateResponseRouteElementsObjectType` - `const DynamicRoutingUpdateResponseRouteElementsObjectTypeStart DynamicRoutingUpdateResponseRouteElementsObjectType = "start"` - `type DynamicRoutingUpdateResponseRouteElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingUpdateResponseRouteElementsObjectOutputs` - `False DynamicRoutingUpdateResponseRouteElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingUpdateResponseRouteElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingUpdateResponseRouteElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingUpdateResponseRouteElementsObjectType` - `const DynamicRoutingUpdateResponseRouteElementsObjectTypeConditional DynamicRoutingUpdateResponseRouteElementsObjectType = "conditional"` - `type DynamicRoutingUpdateResponseRouteElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingUpdateResponseRouteElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingUpdateResponseRouteElementsObjectType` - `const DynamicRoutingUpdateResponseRouteElementsObjectTypePercentage DynamicRoutingUpdateResponseRouteElementsObjectType = "percentage"` - `type DynamicRoutingUpdateResponseRouteElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingUpdateResponseRouteElementsObjectOutputs` - `Fallback DynamicRoutingUpdateResponseRouteElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingUpdateResponseRouteElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingUpdateResponseRouteElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingUpdateResponseRouteElementsObjectPropertiesLimitType` - `const DynamicRoutingUpdateResponseRouteElementsObjectPropertiesLimitTypeCount DynamicRoutingUpdateResponseRouteElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingUpdateResponseRouteElementsObjectPropertiesLimitTypeCost DynamicRoutingUpdateResponseRouteElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingUpdateResponseRouteElementsObjectType` - `const DynamicRoutingUpdateResponseRouteElementsObjectTypeRate DynamicRoutingUpdateResponseRouteElementsObjectType = "rate"` - `type DynamicRoutingUpdateResponseRouteElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingUpdateResponseRouteElementsObjectOutputs` - `Fallback DynamicRoutingUpdateResponseRouteElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingUpdateResponseRouteElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingUpdateResponseRouteElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingUpdateResponseRouteElementsObjectType` - `const DynamicRoutingUpdateResponseRouteElementsObjectTypeModel DynamicRoutingUpdateResponseRouteElementsObjectType = "model"` - `type DynamicRoutingUpdateResponseRouteElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingUpdateResponseRouteElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingUpdateResponseRouteElementsObjectType` - `const DynamicRoutingUpdateResponseRouteElementsObjectTypeEnd DynamicRoutingUpdateResponseRouteElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` - `Version DynamicRoutingUpdateResponseRouteVersion` - `Active DynamicRoutingUpdateResponseRouteVersionActive` - `const DynamicRoutingUpdateResponseRouteVersionActiveTrue DynamicRoutingUpdateResponseRouteVersionActive = "true"` - `const DynamicRoutingUpdateResponseRouteVersionActiveFalse DynamicRoutingUpdateResponseRouteVersionActive = "false"` - `CreatedAt string` - `Data string` - `VersionID string` - `Success 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"), ) dynamicRouting, err := client.AIGateway.DynamicRouting.Update( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingUpdateParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), Name: cloudflare.F("Route Name"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dynamicRouting.Route) } ``` #### Response ```json { "route": { "id": "id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } }, "success": true } ``` ## Delete an AI Gateway Dynamic Route. `client.AIGateway.DynamicRouting.Delete(ctx, gatewayID, id, body) (*DynamicRoutingDeleteResponse, error)` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Delete an AI Gateway Dynamic Route. ### Parameters - `gatewayID string` - `id string` - `body DynamicRoutingDeleteParams` - `AccountID param.Field[string]` ### Returns - `type DynamicRoutingDeleteResponse struct{…}` - `ID string` - `CreatedAt Time` - `Elements []DynamicRoutingDeleteResponseElement` - `type DynamicRoutingDeleteResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingDeleteResponseElementsObjectOutputs` - `Next DynamicRoutingDeleteResponseElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingDeleteResponseElementsObjectType` - `const DynamicRoutingDeleteResponseElementsObjectTypeStart DynamicRoutingDeleteResponseElementsObjectType = "start"` - `type DynamicRoutingDeleteResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingDeleteResponseElementsObjectOutputs` - `False DynamicRoutingDeleteResponseElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingDeleteResponseElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingDeleteResponseElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingDeleteResponseElementsObjectType` - `const DynamicRoutingDeleteResponseElementsObjectTypeConditional DynamicRoutingDeleteResponseElementsObjectType = "conditional"` - `type DynamicRoutingDeleteResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingDeleteResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingDeleteResponseElementsObjectType` - `const DynamicRoutingDeleteResponseElementsObjectTypePercentage DynamicRoutingDeleteResponseElementsObjectType = "percentage"` - `type DynamicRoutingDeleteResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingDeleteResponseElementsObjectOutputs` - `Fallback DynamicRoutingDeleteResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingDeleteResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingDeleteResponseElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingDeleteResponseElementsObjectPropertiesLimitType` - `const DynamicRoutingDeleteResponseElementsObjectPropertiesLimitTypeCount DynamicRoutingDeleteResponseElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingDeleteResponseElementsObjectPropertiesLimitTypeCost DynamicRoutingDeleteResponseElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingDeleteResponseElementsObjectType` - `const DynamicRoutingDeleteResponseElementsObjectTypeRate DynamicRoutingDeleteResponseElementsObjectType = "rate"` - `type DynamicRoutingDeleteResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingDeleteResponseElementsObjectOutputs` - `Fallback DynamicRoutingDeleteResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingDeleteResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingDeleteResponseElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingDeleteResponseElementsObjectType` - `const DynamicRoutingDeleteResponseElementsObjectTypeModel DynamicRoutingDeleteResponseElementsObjectType = "model"` - `type DynamicRoutingDeleteResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingDeleteResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingDeleteResponseElementsObjectType` - `const DynamicRoutingDeleteResponseElementsObjectTypeEnd DynamicRoutingDeleteResponseElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` ### 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"), ) dynamicRouting, err := client.AIGateway.DynamicRouting.Delete( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingDeleteParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dynamicRouting.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## List all AI Gateway Dynamic Route Deployments. `client.AIGateway.DynamicRouting.ListDeployments(ctx, gatewayID, id, query) (*DynamicRoutingListDeploymentsResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments` List all AI Gateway Dynamic Route Deployments. ### Parameters - `gatewayID string` - `id string` - `query DynamicRoutingListDeploymentsParams` - `AccountID param.Field[string]` ### Returns - `type DynamicRoutingListDeploymentsResponse struct{…}` - `Data DynamicRoutingListDeploymentsResponseData` - `Deployments []DynamicRoutingListDeploymentsResponseDataDeployment` - `CreatedAt string` - `DeploymentID string` - `VersionID string` - `OrderBy string` - `OrderByDirection string` - `Page float64` - `PerPage float64` - `Success 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"), ) response, err := client.AIGateway.DynamicRouting.ListDeployments( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingListDeploymentsParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Data) } ``` #### Response ```json { "data": { "deployments": [ { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" } ], "order_by": "order_by", "order_by_direction": "order_by_direction", "page": 0, "per_page": 0 }, "success": true } ``` ## Create a new AI Gateway Dynamic Route Deployment. `client.AIGateway.DynamicRouting.NewDeployment(ctx, gatewayID, id, params) (*DynamicRoutingNewDeploymentResponse, error)` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments` Create a new AI Gateway Dynamic Route Deployment. ### Parameters - `gatewayID string` - `id string` - `params DynamicRoutingNewDeploymentParams` - `AccountID param.Field[string]` Path param - `VersionID param.Field[string]` Body param ### Returns - `type DynamicRoutingNewDeploymentResponse struct{…}` - `ID string` - `CreatedAt Time` - `Elements []DynamicRoutingNewDeploymentResponseElement` - `type DynamicRoutingNewDeploymentResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewDeploymentResponseElementsObjectOutputs` - `Next DynamicRoutingNewDeploymentResponseElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingNewDeploymentResponseElementsObjectType` - `const DynamicRoutingNewDeploymentResponseElementsObjectTypeStart DynamicRoutingNewDeploymentResponseElementsObjectType = "start"` - `type DynamicRoutingNewDeploymentResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewDeploymentResponseElementsObjectOutputs` - `False DynamicRoutingNewDeploymentResponseElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingNewDeploymentResponseElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingNewDeploymentResponseElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingNewDeploymentResponseElementsObjectType` - `const DynamicRoutingNewDeploymentResponseElementsObjectTypeConditional DynamicRoutingNewDeploymentResponseElementsObjectType = "conditional"` - `type DynamicRoutingNewDeploymentResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewDeploymentResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingNewDeploymentResponseElementsObjectType` - `const DynamicRoutingNewDeploymentResponseElementsObjectTypePercentage DynamicRoutingNewDeploymentResponseElementsObjectType = "percentage"` - `type DynamicRoutingNewDeploymentResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewDeploymentResponseElementsObjectOutputs` - `Fallback DynamicRoutingNewDeploymentResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewDeploymentResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewDeploymentResponseElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingNewDeploymentResponseElementsObjectPropertiesLimitType` - `const DynamicRoutingNewDeploymentResponseElementsObjectPropertiesLimitTypeCount DynamicRoutingNewDeploymentResponseElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingNewDeploymentResponseElementsObjectPropertiesLimitTypeCost DynamicRoutingNewDeploymentResponseElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingNewDeploymentResponseElementsObjectType` - `const DynamicRoutingNewDeploymentResponseElementsObjectTypeRate DynamicRoutingNewDeploymentResponseElementsObjectType = "rate"` - `type DynamicRoutingNewDeploymentResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewDeploymentResponseElementsObjectOutputs` - `Fallback DynamicRoutingNewDeploymentResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewDeploymentResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewDeploymentResponseElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingNewDeploymentResponseElementsObjectType` - `const DynamicRoutingNewDeploymentResponseElementsObjectTypeModel DynamicRoutingNewDeploymentResponseElementsObjectType = "model"` - `type DynamicRoutingNewDeploymentResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewDeploymentResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingNewDeploymentResponseElementsObjectType` - `const DynamicRoutingNewDeploymentResponseElementsObjectTypeEnd DynamicRoutingNewDeploymentResponseElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` ### 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"), ) response, err := client.AIGateway.DynamicRouting.NewDeployment( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingNewDeploymentParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), VersionID: cloudflare.F("54442216"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## List all AI Gateway Dynamic Route Versions. `client.AIGateway.DynamicRouting.ListVersions(ctx, gatewayID, id, query) (*DynamicRoutingListVersionsResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions` List all AI Gateway Dynamic Route Versions. ### Parameters - `gatewayID string` - `id string` - `query DynamicRoutingListVersionsParams` - `AccountID param.Field[string]` ### Returns - `type DynamicRoutingListVersionsResponse struct{…}` - `Data DynamicRoutingListVersionsResponseData` - `OrderBy string` - `OrderByDirection string` - `Page float64` - `PerPage float64` - `Versions []DynamicRoutingListVersionsResponseDataVersion` - `Active DynamicRoutingListVersionsResponseDataVersionsActive` - `const DynamicRoutingListVersionsResponseDataVersionsActiveTrue DynamicRoutingListVersionsResponseDataVersionsActive = "true"` - `const DynamicRoutingListVersionsResponseDataVersionsActiveFalse DynamicRoutingListVersionsResponseDataVersionsActive = "false"` - `CreatedAt string` - `Data string` - `VersionID string` - `Success 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"), ) response, err := client.AIGateway.DynamicRouting.ListVersions( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingListVersionsParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Data) } ``` #### Response ```json { "data": { "order_by": "order_by", "order_by_direction": "order_by_direction", "page": 0, "per_page": 0, "versions": [ { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } ] }, "success": true } ``` ## Create a new AI Gateway Dynamic Route Version. `client.AIGateway.DynamicRouting.NewVersion(ctx, gatewayID, id, params) (*DynamicRoutingNewVersionResponse, error)` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions` Create a new AI Gateway Dynamic Route Version. ### Parameters - `gatewayID string` - `id string` - `params DynamicRoutingNewVersionParams` - `AccountID param.Field[string]` Path param - `Elements param.Field[[]DynamicRoutingNewVersionParamsElement]` Body param - `type DynamicRoutingNewVersionParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionParamsElementsObjectOutputs` - `Next DynamicRoutingNewVersionParamsElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingNewVersionParamsElementsObjectType` - `const DynamicRoutingNewVersionParamsElementsObjectTypeStart DynamicRoutingNewVersionParamsElementsObjectType = "start"` - `type DynamicRoutingNewVersionParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionParamsElementsObjectOutputs` - `False DynamicRoutingNewVersionParamsElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingNewVersionParamsElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingNewVersionParamsElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingNewVersionParamsElementsObjectType` - `const DynamicRoutingNewVersionParamsElementsObjectTypeConditional DynamicRoutingNewVersionParamsElementsObjectType = "conditional"` - `type DynamicRoutingNewVersionParamsElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewVersionParamsElementsObjectOutputs]` - `ElementID string` - `Type DynamicRoutingNewVersionParamsElementsObjectType` - `const DynamicRoutingNewVersionParamsElementsObjectTypePercentage DynamicRoutingNewVersionParamsElementsObjectType = "percentage"` - `type DynamicRoutingNewVersionParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionParamsElementsObjectOutputs` - `Fallback DynamicRoutingNewVersionParamsElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewVersionParamsElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewVersionParamsElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingNewVersionParamsElementsObjectPropertiesLimitType` - `const DynamicRoutingNewVersionParamsElementsObjectPropertiesLimitTypeCount DynamicRoutingNewVersionParamsElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingNewVersionParamsElementsObjectPropertiesLimitTypeCost DynamicRoutingNewVersionParamsElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingNewVersionParamsElementsObjectType` - `const DynamicRoutingNewVersionParamsElementsObjectTypeRate DynamicRoutingNewVersionParamsElementsObjectType = "rate"` - `type DynamicRoutingNewVersionParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionParamsElementsObjectOutputs` - `Fallback DynamicRoutingNewVersionParamsElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewVersionParamsElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewVersionParamsElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingNewVersionParamsElementsObjectType` - `const DynamicRoutingNewVersionParamsElementsObjectTypeModel DynamicRoutingNewVersionParamsElementsObjectType = "model"` - `type DynamicRoutingNewVersionParamsElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewVersionParamsElementsObjectOutputs]` - `ElementID string` - `Type DynamicRoutingNewVersionParamsElementsObjectType` - `const DynamicRoutingNewVersionParamsElementsObjectTypeEnd DynamicRoutingNewVersionParamsElementsObjectType = "end"` ### Returns - `type DynamicRoutingNewVersionResponse struct{…}` - `ID string` - `CreatedAt Time` - `Elements []DynamicRoutingNewVersionResponseElement` - `type DynamicRoutingNewVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionResponseElementsObjectOutputs` - `Next DynamicRoutingNewVersionResponseElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingNewVersionResponseElementsObjectType` - `const DynamicRoutingNewVersionResponseElementsObjectTypeStart DynamicRoutingNewVersionResponseElementsObjectType = "start"` - `type DynamicRoutingNewVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionResponseElementsObjectOutputs` - `False DynamicRoutingNewVersionResponseElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingNewVersionResponseElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingNewVersionResponseElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingNewVersionResponseElementsObjectType` - `const DynamicRoutingNewVersionResponseElementsObjectTypeConditional DynamicRoutingNewVersionResponseElementsObjectType = "conditional"` - `type DynamicRoutingNewVersionResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewVersionResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingNewVersionResponseElementsObjectType` - `const DynamicRoutingNewVersionResponseElementsObjectTypePercentage DynamicRoutingNewVersionResponseElementsObjectType = "percentage"` - `type DynamicRoutingNewVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionResponseElementsObjectOutputs` - `Fallback DynamicRoutingNewVersionResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewVersionResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewVersionResponseElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingNewVersionResponseElementsObjectPropertiesLimitType` - `const DynamicRoutingNewVersionResponseElementsObjectPropertiesLimitTypeCount DynamicRoutingNewVersionResponseElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingNewVersionResponseElementsObjectPropertiesLimitTypeCost DynamicRoutingNewVersionResponseElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingNewVersionResponseElementsObjectType` - `const DynamicRoutingNewVersionResponseElementsObjectTypeRate DynamicRoutingNewVersionResponseElementsObjectType = "rate"` - `type DynamicRoutingNewVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionResponseElementsObjectOutputs` - `Fallback DynamicRoutingNewVersionResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewVersionResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewVersionResponseElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingNewVersionResponseElementsObjectType` - `const DynamicRoutingNewVersionResponseElementsObjectTypeModel DynamicRoutingNewVersionResponseElementsObjectType = "model"` - `type DynamicRoutingNewVersionResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewVersionResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingNewVersionResponseElementsObjectType` - `const DynamicRoutingNewVersionResponseElementsObjectTypeEnd DynamicRoutingNewVersionResponseElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` ### 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"), ) response, err := client.AIGateway.DynamicRouting.NewVersion( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingNewVersionParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), Elements: cloudflare.F([]ai_gateway.DynamicRoutingNewVersionParamsElementUnion{ai_gateway.DynamicRoutingNewVersionParamsElementsObject{ ID: cloudflare.F("id"), Outputs: cloudflare.F(ai_gateway.DynamicRoutingNewVersionParamsElementsObjectOutputs{ Next: cloudflare.F(ai_gateway.DynamicRoutingNewVersionParamsElementsObjectOutputsNext{ ElementID: cloudflare.F("elementId"), }), }), Type: cloudflare.F(ai_gateway.DynamicRoutingNewVersionParamsElementsObjectTypeStart), }}), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## Get an AI Gateway Dynamic Route Version. `client.AIGateway.DynamicRouting.GetVersion(ctx, gatewayID, id, versionID, query) (*DynamicRoutingGetVersionResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions/{version_id}` Get an AI Gateway Dynamic Route Version. ### Parameters - `gatewayID string` - `id string` - `versionID string` - `query DynamicRoutingGetVersionParams` - `AccountID param.Field[string]` ### Returns - `type DynamicRoutingGetVersionResponse struct{…}` - `ID string` - `Active DynamicRoutingGetVersionResponseActive` - `const DynamicRoutingGetVersionResponseActiveTrue DynamicRoutingGetVersionResponseActive = "true"` - `const DynamicRoutingGetVersionResponseActiveFalse DynamicRoutingGetVersionResponseActive = "false"` - `CreatedAt string` - `Data string` - `Elements []DynamicRoutingGetVersionResponseElement` - `type DynamicRoutingGetVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetVersionResponseElementsObjectOutputs` - `Next DynamicRoutingGetVersionResponseElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingGetVersionResponseElementsObjectType` - `const DynamicRoutingGetVersionResponseElementsObjectTypeStart DynamicRoutingGetVersionResponseElementsObjectType = "start"` - `type DynamicRoutingGetVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetVersionResponseElementsObjectOutputs` - `False DynamicRoutingGetVersionResponseElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingGetVersionResponseElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingGetVersionResponseElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingGetVersionResponseElementsObjectType` - `const DynamicRoutingGetVersionResponseElementsObjectTypeConditional DynamicRoutingGetVersionResponseElementsObjectType = "conditional"` - `type DynamicRoutingGetVersionResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingGetVersionResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingGetVersionResponseElementsObjectType` - `const DynamicRoutingGetVersionResponseElementsObjectTypePercentage DynamicRoutingGetVersionResponseElementsObjectType = "percentage"` - `type DynamicRoutingGetVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetVersionResponseElementsObjectOutputs` - `Fallback DynamicRoutingGetVersionResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingGetVersionResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingGetVersionResponseElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingGetVersionResponseElementsObjectPropertiesLimitType` - `const DynamicRoutingGetVersionResponseElementsObjectPropertiesLimitTypeCount DynamicRoutingGetVersionResponseElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingGetVersionResponseElementsObjectPropertiesLimitTypeCost DynamicRoutingGetVersionResponseElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingGetVersionResponseElementsObjectType` - `const DynamicRoutingGetVersionResponseElementsObjectTypeRate DynamicRoutingGetVersionResponseElementsObjectType = "rate"` - `type DynamicRoutingGetVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetVersionResponseElementsObjectOutputs` - `Fallback DynamicRoutingGetVersionResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingGetVersionResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingGetVersionResponseElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingGetVersionResponseElementsObjectType` - `const DynamicRoutingGetVersionResponseElementsObjectTypeModel DynamicRoutingGetVersionResponseElementsObjectType = "model"` - `type DynamicRoutingGetVersionResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingGetVersionResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingGetVersionResponseElementsObjectType` - `const DynamicRoutingGetVersionResponseElementsObjectTypeEnd DynamicRoutingGetVersionResponseElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` - `VersionID string` ### 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"), ) response, err := client.AIGateway.DynamicRouting.GetVersion( context.TODO(), "54442216", "54442216", "54442216", ai_gateway.DynamicRoutingGetVersionParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "result": { "id": "id", "active": "true", "created_at": "created_at", "data": "data", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version_id": "version_id" }, "success": true } ```