# Magic Transit ## Domain Types ### Health Check - `type HealthCheck struct{…}` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target HealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type HealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` ### Health Check Rate - `type HealthCheckRate string` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` ### Health Check Type - `type HealthCheckType string` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` # Apps ## List Apps `client.MagicTransit.Apps.List(ctx, query) (*SinglePage[AppListResponse], error)` **get** `/accounts/{account_id}/magic/apps` Lists Apps associated with an account. ### Parameters - `query AppListParams` - `AccountID param.Field[string]` Identifier ### Returns - `type AppListResponse interface{…}` Collection of Hostnames and/or IP Subnets to associate with traffic decisions. - `type AppListResponseMagicAccountApp struct{…}` Custom app defined for an account. - `AccountAppID string` Magic account app ID. - `Hostnames []string` FQDNs to associate with traffic decisions. - `IPSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Name string` Display name for the app. - `SourceSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Type string` Category of the app. - `type AppListResponseMagicManagedApp struct{…}` Managed app defined by Cloudflare. - `ManagedAppID string` Managed app ID. - `Hostnames []string` FQDNs to associate with traffic decisions. - `IPSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Name string` Display name for the app. - `SourceSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Type string` Category of the app. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.MagicTransit.Apps.List(context.TODO(), magic_transit.AppListParams{ AccountID: 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": [ { "account_app_id": "ac60d3d0435248289d446cedd870bcf4", "hostnames": [ "auth.cloudflare.com" ], "ip_subnets": [ "192.0.2.0/24" ], "name": "Cloudflare Dashboard", "source_subnets": [ "192.0.2.0/24" ], "type": "Development" } ], "success": true } ``` ## Create a new App `client.MagicTransit.Apps.New(ctx, params) (*AppNewResponse, error)` **post** `/accounts/{account_id}/magic/apps` Creates a new App for an account ### Parameters - `params AppNewParams` - `AccountID param.Field[string]` Path param: Identifier - `Name param.Field[string]` Body param: Display name for the app. - `Type param.Field[string]` Body param: Category of the app. - `Hostnames param.Field[[]string]` Body param: FQDNs to associate with traffic decisions. - `IPSubnets param.Field[[]string]` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `SourceSubnets param.Field[[]string]` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) ### Returns - `type AppNewResponse struct{…}` Custom app defined for an account. - `AccountAppID string` Magic account app ID. - `Hostnames []string` FQDNs to associate with traffic decisions. - `IPSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Name string` Display name for the app. - `SourceSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Type string` Category of the app. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) app, err := client.MagicTransit.Apps.New(context.TODO(), magic_transit.AppNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("Cloudflare Dashboard"), Type: cloudflare.F("Development"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", app.AccountAppID) } ``` #### 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": { "account_app_id": "ac60d3d0435248289d446cedd870bcf4", "hostnames": [ "auth.cloudflare.com" ], "ip_subnets": [ "192.0.2.0/24" ], "name": "Cloudflare Dashboard", "source_subnets": [ "192.0.2.0/24" ], "type": "Development" }, "success": true } ``` ## Update an App `client.MagicTransit.Apps.Update(ctx, accountAppID, params) (*AppUpdateResponse, error)` **put** `/accounts/{account_id}/magic/apps/{account_app_id}` Updates an Account App ### Parameters - `accountAppID string` Identifier - `params AppUpdateParams` - `AccountID param.Field[string]` Path param: Identifier - `Hostnames param.Field[[]string]` Body param: FQDNs to associate with traffic decisions. - `IPSubnets param.Field[[]string]` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Name param.Field[string]` Body param: Display name for the app. - `SourceSubnets param.Field[[]string]` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Type param.Field[string]` Body param: Category of the app. ### Returns - `type AppUpdateResponse struct{…}` Custom app defined for an account. - `AccountAppID string` Magic account app ID. - `Hostnames []string` FQDNs to associate with traffic decisions. - `IPSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Name string` Display name for the app. - `SourceSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Type string` Category of the app. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) app, err := client.MagicTransit.Apps.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.AppUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", app.AccountAppID) } ``` #### 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": { "account_app_id": "ac60d3d0435248289d446cedd870bcf4", "hostnames": [ "auth.cloudflare.com" ], "ip_subnets": [ "192.0.2.0/24" ], "name": "Cloudflare Dashboard", "source_subnets": [ "192.0.2.0/24" ], "type": "Development" }, "success": true } ``` ## Update an App `client.MagicTransit.Apps.Edit(ctx, accountAppID, params) (*AppEditResponse, error)` **patch** `/accounts/{account_id}/magic/apps/{account_app_id}` Updates an Account App ### Parameters - `accountAppID string` Identifier - `params AppEditParams` - `AccountID param.Field[string]` Path param: Identifier - `Hostnames param.Field[[]string]` Body param: FQDNs to associate with traffic decisions. - `IPSubnets param.Field[[]string]` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Name param.Field[string]` Body param: Display name for the app. - `SourceSubnets param.Field[[]string]` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Type param.Field[string]` Body param: Category of the app. ### Returns - `type AppEditResponse struct{…}` Custom app defined for an account. - `AccountAppID string` Magic account app ID. - `Hostnames []string` FQDNs to associate with traffic decisions. - `IPSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Name string` Display name for the app. - `SourceSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Type string` Category of the app. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.MagicTransit.Apps.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.AppEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.AccountAppID) } ``` #### 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": { "account_app_id": "ac60d3d0435248289d446cedd870bcf4", "hostnames": [ "auth.cloudflare.com" ], "ip_subnets": [ "192.0.2.0/24" ], "name": "Cloudflare Dashboard", "source_subnets": [ "192.0.2.0/24" ], "type": "Development" }, "success": true } ``` ## Delete Account App `client.MagicTransit.Apps.Delete(ctx, accountAppID, body) (*AppDeleteResponse, error)` **delete** `/accounts/{account_id}/magic/apps/{account_app_id}` Deletes specific Account App. ### Parameters - `accountAppID string` Identifier - `body AppDeleteParams` - `AccountID param.Field[string]` Identifier ### Returns - `type AppDeleteResponse struct{…}` Custom app defined for an account. - `AccountAppID string` Magic account app ID. - `Hostnames []string` FQDNs to associate with traffic decisions. - `IPSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Name string` Display name for the app. - `SourceSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Type string` Category of the app. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) app, err := client.MagicTransit.Apps.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.AppDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", app.AccountAppID) } ``` #### 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": { "account_app_id": "ac60d3d0435248289d446cedd870bcf4", "hostnames": [ "auth.cloudflare.com" ], "ip_subnets": [ "192.0.2.0/24" ], "name": "Cloudflare Dashboard", "source_subnets": [ "192.0.2.0/24" ], "type": "Development" }, "success": true } ``` # Cf Interconnects ## List interconnects `client.MagicTransit.CfInterconnects.List(ctx, params) (*CfInterconnectListResponse, error)` **get** `/accounts/{account_id}/magic/cf_interconnects` Lists interconnects associated with an account. ### Parameters - `params CfInterconnectListParams` - `AccountID param.Field[string]` Path param: Identifier - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the response body will be presented using the new object format. Defaults to false. ### Returns - `type CfInterconnectListResponse struct{…}` - `Interconnects []CfInterconnectListResponseInterconnect` - `ID string` Identifier - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `ColoName string` The name of the interconnect. The name cannot share a name with other tunnels. - `CreatedOn Time` The date and time the tunnel was created. - `Description string` An optional description of the interconnect. - `GRE CfInterconnectListResponseInterconnectsGRE` The configuration specific to GRE interconnects. - `CloudflareEndpoint string` The IP address assigned to the Cloudflare side of the GRE tunnel created as part of the Interconnect. - `HealthCheck HealthCheck` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target HealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type HealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `Mtu int64` The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum value is 576. - `Name string` The name of the interconnect. The name cannot share a name with other tunnels. - `VirtualPortReservationID string` An identifier that correlates this interconnect with the corresponding V2 CNI interconnect resource. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) cfInterconnects, err := client.MagicTransit.CfInterconnects.List(context.TODO(), magic_transit.CfInterconnectListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", cfInterconnects.Interconnects) } ``` #### 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": { "interconnects": [ { "id": "c4a7362d577a6c3019a474fd6f485821", "automatic_return_routing": true, "colo_name": "pni_ord", "created_on": "2017-06-14T00:00:00Z", "description": "Tunnel for Interconnect to ORD", "gre": { "cloudflare_endpoint": "203.0.113.1" }, "health_check": { "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address": "192.0.2.0/31", "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "mtu": 0, "name": "pni_ord", "virtual_port_reservation_id": "c4a7362d577a6c3019a474fd6f485821" } ] }, "success": true } ``` ## List interconnect Details `client.MagicTransit.CfInterconnects.Get(ctx, cfInterconnectID, params) (*CfInterconnectGetResponse, error)` **get** `/accounts/{account_id}/magic/cf_interconnects/{cf_interconnect_id}` Lists details for a specific interconnect. ### Parameters - `cfInterconnectID string` Identifier - `params CfInterconnectGetParams` - `AccountID param.Field[string]` Path param: Identifier - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the response body will be presented using the new object format. Defaults to false. ### Returns - `type CfInterconnectGetResponse struct{…}` - `Interconnect CfInterconnectGetResponseInterconnect` - `ID string` Identifier - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `ColoName string` The name of the interconnect. The name cannot share a name with other tunnels. - `CreatedOn Time` The date and time the tunnel was created. - `Description string` An optional description of the interconnect. - `GRE CfInterconnectGetResponseInterconnectGRE` The configuration specific to GRE interconnects. - `CloudflareEndpoint string` The IP address assigned to the Cloudflare side of the GRE tunnel created as part of the Interconnect. - `HealthCheck HealthCheck` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target HealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type HealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `Mtu int64` The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum value is 576. - `Name string` The name of the interconnect. The name cannot share a name with other tunnels. - `VirtualPortReservationID string` An identifier that correlates this interconnect with the corresponding V2 CNI interconnect resource. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) cfInterconnect, err := client.MagicTransit.CfInterconnects.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.CfInterconnectGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", cfInterconnect.Interconnect) } ``` #### 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": { "interconnect": { "id": "c4a7362d577a6c3019a474fd6f485821", "automatic_return_routing": true, "colo_name": "pni_ord", "created_on": "2017-06-14T00:00:00Z", "description": "Tunnel for Interconnect to ORD", "gre": { "cloudflare_endpoint": "203.0.113.1" }, "health_check": { "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address": "192.0.2.0/31", "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "mtu": 0, "name": "pni_ord", "virtual_port_reservation_id": "c4a7362d577a6c3019a474fd6f485821" } }, "success": true } ``` ## Update interconnect `client.MagicTransit.CfInterconnects.Update(ctx, cfInterconnectID, params) (*CfInterconnectUpdateResponse, error)` **put** `/accounts/{account_id}/magic/cf_interconnects/{cf_interconnect_id}` Updates a specific interconnect associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. ### Parameters - `cfInterconnectID string` Identifier - `params CfInterconnectUpdateParams` - `AccountID param.Field[string]` Path param: Identifier - `AutomaticReturnRouting param.Field[bool]` Body param: True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `Description param.Field[string]` Body param: An optional description of the interconnect. - `GRE param.Field[CfInterconnectUpdateParamsGRE]` Body param: The configuration specific to GRE interconnects. - `CloudflareEndpoint string` The IP address assigned to the Cloudflare side of the GRE tunnel created as part of the Interconnect. - `HealthCheck param.Field[HealthCheck]` Body param - `InterfaceAddress param.Field[string]` Body param: A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `InterfaceAddress6 param.Field[string]` Body param: A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `Mtu param.Field[int64]` Body param: The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum value is 576. - `Name param.Field[string]` Body param: The name of the interconnect. The name cannot share a name with other tunnels. - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false. ### Returns - `type CfInterconnectUpdateResponse struct{…}` - `Modified bool` - `ModifiedInterconnect CfInterconnectUpdateResponseModifiedInterconnect` - `ID string` Identifier - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `ColoName string` The name of the interconnect. The name cannot share a name with other tunnels. - `CreatedOn Time` The date and time the tunnel was created. - `Description string` An optional description of the interconnect. - `GRE CfInterconnectUpdateResponseModifiedInterconnectGRE` The configuration specific to GRE interconnects. - `CloudflareEndpoint string` The IP address assigned to the Cloudflare side of the GRE tunnel created as part of the Interconnect. - `HealthCheck HealthCheck` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target HealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type HealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `Mtu int64` The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum value is 576. - `Name string` The name of the interconnect. The name cannot share a name with other tunnels. - `VirtualPortReservationID string` An identifier that correlates this interconnect with the corresponding V2 CNI interconnect resource. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) cfInterconnect, err := client.MagicTransit.CfInterconnects.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.CfInterconnectUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", cfInterconnect.Modified) } ``` #### 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": { "modified": true, "modified_interconnect": { "id": "c4a7362d577a6c3019a474fd6f485821", "automatic_return_routing": true, "colo_name": "pni_ord", "created_on": "2017-06-14T00:00:00Z", "description": "Tunnel for Interconnect to ORD", "gre": { "cloudflare_endpoint": "203.0.113.1" }, "health_check": { "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address": "192.0.2.0/31", "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "mtu": 0, "name": "pni_ord", "virtual_port_reservation_id": "c4a7362d577a6c3019a474fd6f485821" } }, "success": true } ``` ## Update multiple interconnects `client.MagicTransit.CfInterconnects.BulkUpdate(ctx, params) (*CfInterconnectBulkUpdateResponse, error)` **put** `/accounts/{account_id}/magic/cf_interconnects` Updates multiple interconnects associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. ### Parameters - `params CfInterconnectBulkUpdateParams` - `AccountID param.Field[string]` Path param: Identifier - `Body param.Field[unknown]` Body param - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false. ### Returns - `type CfInterconnectBulkUpdateResponse struct{…}` - `Modified bool` - `ModifiedInterconnects []CfInterconnectBulkUpdateResponseModifiedInterconnect` - `ID string` Identifier - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `ColoName string` The name of the interconnect. The name cannot share a name with other tunnels. - `CreatedOn Time` The date and time the tunnel was created. - `Description string` An optional description of the interconnect. - `GRE CfInterconnectBulkUpdateResponseModifiedInterconnectsGRE` The configuration specific to GRE interconnects. - `CloudflareEndpoint string` The IP address assigned to the Cloudflare side of the GRE tunnel created as part of the Interconnect. - `HealthCheck HealthCheck` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target HealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type HealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `Mtu int64` The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum value is 576. - `Name string` The name of the interconnect. The name cannot share a name with other tunnels. - `VirtualPortReservationID string` An identifier that correlates this interconnect with the corresponding V2 CNI interconnect resource. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.MagicTransit.CfInterconnects.BulkUpdate(context.TODO(), magic_transit.CfInterconnectBulkUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: map[string]interface{}{ }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Modified) } ``` #### 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": { "modified": true, "modified_interconnects": [ { "id": "c4a7362d577a6c3019a474fd6f485821", "automatic_return_routing": true, "colo_name": "pni_ord", "created_on": "2017-06-14T00:00:00Z", "description": "Tunnel for Interconnect to ORD", "gre": { "cloudflare_endpoint": "203.0.113.1" }, "health_check": { "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address": "192.0.2.0/31", "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "mtu": 0, "name": "pni_ord", "virtual_port_reservation_id": "c4a7362d577a6c3019a474fd6f485821" } ] }, "success": true } ``` # GRE Tunnels ## List GRE tunnels `client.MagicTransit.GRETunnels.List(ctx, params) (*GRETunnelListResponse, error)` **get** `/accounts/{account_id}/magic/gre_tunnels` Lists GRE tunnels associated with an account. ### Parameters - `params GRETunnelListParams` - `AccountID param.Field[string]` Path param: Identifier - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the response body will be presented using the new object format. Defaults to false. ### Returns - `type GRETunnelListResponse struct{…}` - `GRETunnels []GRETunnelListResponseGRETunnel` - `ID string` Identifier - `CloudflareGREEndpoint string` The IP address assigned to the Cloudflare side of the GRE tunnel. - `CustomerGREEndpoint string` The IP address assigned to the customer side of the GRE tunnel. - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name string` The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel. - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP GRETunnelListResponseGRETunnelsBGP` - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `BGPStatus GRETunnelListResponseGRETunnelsBGPStatus` - `State GRETunnelListResponseGRETunnelsBGPStatusState` - `const GRETunnelListResponseGRETunnelsBGPStatusStateBGPDown GRETunnelListResponseGRETunnelsBGPStatusState = "BGP_DOWN"` - `const GRETunnelListResponseGRETunnelsBGPStatusStateBGPUp GRETunnelListResponseGRETunnelsBGPStatusState = "BGP_UP"` - `const GRETunnelListResponseGRETunnelsBGPStatusStateBGPEstablishing GRETunnelListResponseGRETunnelsBGPStatusState = "BGP_ESTABLISHING"` - `TCPEstablished bool` - `UpdatedAt Time` - `BGPState string` - `CfSpeakerIP string` - `CfSpeakerPort int64` - `CustomerSpeakerIP string` - `CustomerSpeakerPort int64` - `CreatedOn Time` The date and time the tunnel was created. - `Description string` An optional description of the GRE tunnel. - `HealthCheck GRETunnelListResponseGRETunnelsHealthCheck` - `Direction GRETunnelListResponseGRETunnelsHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const GRETunnelListResponseGRETunnelsHealthCheckDirectionUnidirectional GRETunnelListResponseGRETunnelsHealthCheckDirection = "unidirectional"` - `const GRETunnelListResponseGRETunnelsHealthCheckDirectionBidirectional GRETunnelListResponseGRETunnelsHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target GRETunnelListResponseGRETunnelsHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type GRETunnelListResponseGRETunnelsHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `Mtu int64` Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576. - `TTL int64` Time To Live (TTL) in number of hops of the GRE tunnel. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) greTunnels, err := client.MagicTransit.GRETunnels.List(context.TODO(), magic_transit.GRETunnelListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", greTunnels.GRETunnels) } ``` #### 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": { "gre_tunnels": [ { "id": "c4a7362d577a6c3019a474fd6f485821", "cloudflare_gre_endpoint": "203.0.113.1", "customer_gre_endpoint": "203.0.113.1", "interface_address": "192.0.2.0/31", "name": "GRE_1", "automatic_return_routing": true, "bgp": { "customer_asn": 0, "extra_prefixes": [ "string" ], "md5_key": "md5_key" }, "bgp_status": { "state": "BGP_DOWN", "tcp_established": true, "updated_at": "2019-12-27T18:11:19.117Z", "bgp_state": "bgp_state", "cf_speaker_ip": "192.168.1.1", "cf_speaker_port": 1, "customer_speaker_ip": "192.168.1.1", "customer_speaker_port": 1 }, "created_on": "2017-06-14T00:00:00Z", "description": "Tunnel for ISP X", "health_check": { "direction": "bidirectional", "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "mtu": 0, "ttl": 0 } ] }, "success": true } ``` ## List GRE Tunnel Details `client.MagicTransit.GRETunnels.Get(ctx, greTunnelID, params) (*GRETunnelGetResponse, error)` **get** `/accounts/{account_id}/magic/gre_tunnels/{gre_tunnel_id}` Lists informtion for a specific GRE tunnel. ### Parameters - `greTunnelID string` Identifier - `params GRETunnelGetParams` - `AccountID param.Field[string]` Path param: Identifier - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the response body will be presented using the new object format. Defaults to false. ### Returns - `type GRETunnelGetResponse struct{…}` - `GRETunnel GRETunnelGetResponseGRETunnel` - `ID string` Identifier - `CloudflareGREEndpoint string` The IP address assigned to the Cloudflare side of the GRE tunnel. - `CustomerGREEndpoint string` The IP address assigned to the customer side of the GRE tunnel. - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name string` The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel. - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP GRETunnelGetResponseGRETunnelBGP` - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `BGPStatus GRETunnelGetResponseGRETunnelBGPStatus` - `State GRETunnelGetResponseGRETunnelBGPStatusState` - `const GRETunnelGetResponseGRETunnelBGPStatusStateBGPDown GRETunnelGetResponseGRETunnelBGPStatusState = "BGP_DOWN"` - `const GRETunnelGetResponseGRETunnelBGPStatusStateBGPUp GRETunnelGetResponseGRETunnelBGPStatusState = "BGP_UP"` - `const GRETunnelGetResponseGRETunnelBGPStatusStateBGPEstablishing GRETunnelGetResponseGRETunnelBGPStatusState = "BGP_ESTABLISHING"` - `TCPEstablished bool` - `UpdatedAt Time` - `BGPState string` - `CfSpeakerIP string` - `CfSpeakerPort int64` - `CustomerSpeakerIP string` - `CustomerSpeakerPort int64` - `CreatedOn Time` The date and time the tunnel was created. - `Description string` An optional description of the GRE tunnel. - `HealthCheck GRETunnelGetResponseGRETunnelHealthCheck` - `Direction GRETunnelGetResponseGRETunnelHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const GRETunnelGetResponseGRETunnelHealthCheckDirectionUnidirectional GRETunnelGetResponseGRETunnelHealthCheckDirection = "unidirectional"` - `const GRETunnelGetResponseGRETunnelHealthCheckDirectionBidirectional GRETunnelGetResponseGRETunnelHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target GRETunnelGetResponseGRETunnelHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type GRETunnelGetResponseGRETunnelHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `Mtu int64` Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576. - `TTL int64` Time To Live (TTL) in number of hops of the GRE tunnel. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) greTunnel, err := client.MagicTransit.GRETunnels.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.GRETunnelGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", greTunnel.GRETunnel) } ``` #### 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": { "gre_tunnel": { "id": "c4a7362d577a6c3019a474fd6f485821", "cloudflare_gre_endpoint": "203.0.113.1", "customer_gre_endpoint": "203.0.113.1", "interface_address": "192.0.2.0/31", "name": "GRE_1", "automatic_return_routing": true, "bgp": { "customer_asn": 0, "extra_prefixes": [ "string" ], "md5_key": "md5_key" }, "bgp_status": { "state": "BGP_DOWN", "tcp_established": true, "updated_at": "2019-12-27T18:11:19.117Z", "bgp_state": "bgp_state", "cf_speaker_ip": "192.168.1.1", "cf_speaker_port": 1, "customer_speaker_ip": "192.168.1.1", "customer_speaker_port": 1 }, "created_on": "2017-06-14T00:00:00Z", "description": "Tunnel for ISP X", "health_check": { "direction": "bidirectional", "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "mtu": 0, "ttl": 0 } }, "success": true } ``` ## Create a GRE tunnel `client.MagicTransit.GRETunnels.New(ctx, params) (*GRETunnelNewResponse, error)` **post** `/accounts/{account_id}/magic/gre_tunnels` Creates a new GRE tunnel. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. ### Parameters - `params GRETunnelNewParams` - `AccountID param.Field[string]` Path param: Identifier - `CloudflareGREEndpoint param.Field[string]` Body param: The IP address assigned to the Cloudflare side of the GRE tunnel. - `CustomerGREEndpoint param.Field[string]` Body param: The IP address assigned to the customer side of the GRE tunnel. - `InterfaceAddress param.Field[string]` Body param: A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name param.Field[string]` Body param: The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel. - `AutomaticReturnRouting param.Field[bool]` Body param: True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP param.Field[GRETunnelNewParamsBGP]` Body param - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `Description param.Field[string]` Body param: An optional description of the GRE tunnel. - `HealthCheck param.Field[GRETunnelNewParamsHealthCheck]` Body param - `Direction GRETunnelNewParamsHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const GRETunnelNewParamsHealthCheckDirectionUnidirectional GRETunnelNewParamsHealthCheckDirection = "unidirectional"` - `const GRETunnelNewParamsHealthCheckDirectionBidirectional GRETunnelNewParamsHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target GRETunnelNewParamsHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type GRETunnelNewParamsHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 param.Field[string]` Body param: A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `Mtu param.Field[int64]` Body param: Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576. - `TTL param.Field[int64]` Body param: Time To Live (TTL) in number of hops of the GRE tunnel. - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false. ### Returns - `type GRETunnelNewResponse struct{…}` - `ID string` Identifier - `CloudflareGREEndpoint string` The IP address assigned to the Cloudflare side of the GRE tunnel. - `CustomerGREEndpoint string` The IP address assigned to the customer side of the GRE tunnel. - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name string` The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel. - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP GRETunnelNewResponseBGP` - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `BGPStatus GRETunnelNewResponseBGPStatus` - `State GRETunnelNewResponseBGPStatusState` - `const GRETunnelNewResponseBGPStatusStateBGPDown GRETunnelNewResponseBGPStatusState = "BGP_DOWN"` - `const GRETunnelNewResponseBGPStatusStateBGPUp GRETunnelNewResponseBGPStatusState = "BGP_UP"` - `const GRETunnelNewResponseBGPStatusStateBGPEstablishing GRETunnelNewResponseBGPStatusState = "BGP_ESTABLISHING"` - `TCPEstablished bool` - `UpdatedAt Time` - `BGPState string` - `CfSpeakerIP string` - `CfSpeakerPort int64` - `CustomerSpeakerIP string` - `CustomerSpeakerPort int64` - `CreatedOn Time` The date and time the tunnel was created. - `Description string` An optional description of the GRE tunnel. - `HealthCheck GRETunnelNewResponseHealthCheck` - `Direction GRETunnelNewResponseHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const GRETunnelNewResponseHealthCheckDirectionUnidirectional GRETunnelNewResponseHealthCheckDirection = "unidirectional"` - `const GRETunnelNewResponseHealthCheckDirectionBidirectional GRETunnelNewResponseHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target GRETunnelNewResponseHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type GRETunnelNewResponseHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `Mtu int64` Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576. - `TTL int64` Time To Live (TTL) in number of hops of the GRE tunnel. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) greTunnel, err := client.MagicTransit.GRETunnels.New(context.TODO(), magic_transit.GRETunnelNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), CloudflareGREEndpoint: cloudflare.F("203.0.113.1"), CustomerGREEndpoint: cloudflare.F("203.0.113.1"), InterfaceAddress: cloudflare.F("192.0.2.0/31"), Name: cloudflare.F("GRE_1"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", greTunnel.ID) } ``` #### 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": { "id": "c4a7362d577a6c3019a474fd6f485821", "cloudflare_gre_endpoint": "203.0.113.1", "customer_gre_endpoint": "203.0.113.1", "interface_address": "192.0.2.0/31", "name": "GRE_1", "automatic_return_routing": true, "bgp": { "customer_asn": 0, "extra_prefixes": [ "string" ], "md5_key": "md5_key" }, "bgp_status": { "state": "BGP_DOWN", "tcp_established": true, "updated_at": "2019-12-27T18:11:19.117Z", "bgp_state": "bgp_state", "cf_speaker_ip": "192.168.1.1", "cf_speaker_port": 1, "customer_speaker_ip": "192.168.1.1", "customer_speaker_port": 1 }, "created_on": "2017-06-14T00:00:00Z", "description": "Tunnel for ISP X", "health_check": { "direction": "bidirectional", "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "mtu": 0, "ttl": 0 }, "success": true } ``` ## Update GRE Tunnel `client.MagicTransit.GRETunnels.Update(ctx, greTunnelID, params) (*GRETunnelUpdateResponse, error)` **put** `/accounts/{account_id}/magic/gre_tunnels/{gre_tunnel_id}` Updates a specific GRE tunnel. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. ### Parameters - `greTunnelID string` Identifier - `params GRETunnelUpdateParams` - `AccountID param.Field[string]` Path param: Identifier - `CloudflareGREEndpoint param.Field[string]` Body param: The IP address assigned to the Cloudflare side of the GRE tunnel. - `CustomerGREEndpoint param.Field[string]` Body param: The IP address assigned to the customer side of the GRE tunnel. - `InterfaceAddress param.Field[string]` Body param: A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name param.Field[string]` Body param: The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel. - `AutomaticReturnRouting param.Field[bool]` Body param: True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `Description param.Field[string]` Body param: An optional description of the GRE tunnel. - `HealthCheck param.Field[GRETunnelUpdateParamsHealthCheck]` Body param - `Direction GRETunnelUpdateParamsHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const GRETunnelUpdateParamsHealthCheckDirectionUnidirectional GRETunnelUpdateParamsHealthCheckDirection = "unidirectional"` - `const GRETunnelUpdateParamsHealthCheckDirectionBidirectional GRETunnelUpdateParamsHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target GRETunnelUpdateParamsHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type GRETunnelUpdateParamsHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 param.Field[string]` Body param: A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `Mtu param.Field[int64]` Body param: Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576. - `TTL param.Field[int64]` Body param: Time To Live (TTL) in number of hops of the GRE tunnel. - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false. ### Returns - `type GRETunnelUpdateResponse struct{…}` - `Modified bool` - `ModifiedGRETunnel GRETunnelUpdateResponseModifiedGRETunnel` - `ID string` Identifier - `CloudflareGREEndpoint string` The IP address assigned to the Cloudflare side of the GRE tunnel. - `CustomerGREEndpoint string` The IP address assigned to the customer side of the GRE tunnel. - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name string` The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel. - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP GRETunnelUpdateResponseModifiedGRETunnelBGP` - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `BGPStatus GRETunnelUpdateResponseModifiedGRETunnelBGPStatus` - `State GRETunnelUpdateResponseModifiedGRETunnelBGPStatusState` - `const GRETunnelUpdateResponseModifiedGRETunnelBGPStatusStateBGPDown GRETunnelUpdateResponseModifiedGRETunnelBGPStatusState = "BGP_DOWN"` - `const GRETunnelUpdateResponseModifiedGRETunnelBGPStatusStateBGPUp GRETunnelUpdateResponseModifiedGRETunnelBGPStatusState = "BGP_UP"` - `const GRETunnelUpdateResponseModifiedGRETunnelBGPStatusStateBGPEstablishing GRETunnelUpdateResponseModifiedGRETunnelBGPStatusState = "BGP_ESTABLISHING"` - `TCPEstablished bool` - `UpdatedAt Time` - `BGPState string` - `CfSpeakerIP string` - `CfSpeakerPort int64` - `CustomerSpeakerIP string` - `CustomerSpeakerPort int64` - `CreatedOn Time` The date and time the tunnel was created. - `Description string` An optional description of the GRE tunnel. - `HealthCheck GRETunnelUpdateResponseModifiedGRETunnelHealthCheck` - `Direction GRETunnelUpdateResponseModifiedGRETunnelHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const GRETunnelUpdateResponseModifiedGRETunnelHealthCheckDirectionUnidirectional GRETunnelUpdateResponseModifiedGRETunnelHealthCheckDirection = "unidirectional"` - `const GRETunnelUpdateResponseModifiedGRETunnelHealthCheckDirectionBidirectional GRETunnelUpdateResponseModifiedGRETunnelHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target GRETunnelUpdateResponseModifiedGRETunnelHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type GRETunnelUpdateResponseModifiedGRETunnelHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `Mtu int64` Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576. - `TTL int64` Time To Live (TTL) in number of hops of the GRE tunnel. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) greTunnel, err := client.MagicTransit.GRETunnels.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.GRETunnelUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), CloudflareGREEndpoint: cloudflare.F("203.0.113.1"), CustomerGREEndpoint: cloudflare.F("203.0.113.1"), InterfaceAddress: cloudflare.F("192.0.2.0/31"), Name: cloudflare.F("GRE_1"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", greTunnel.Modified) } ``` #### 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": { "modified": true, "modified_gre_tunnel": { "id": "c4a7362d577a6c3019a474fd6f485821", "cloudflare_gre_endpoint": "203.0.113.1", "customer_gre_endpoint": "203.0.113.1", "interface_address": "192.0.2.0/31", "name": "GRE_1", "automatic_return_routing": true, "bgp": { "customer_asn": 0, "extra_prefixes": [ "string" ], "md5_key": "md5_key" }, "bgp_status": { "state": "BGP_DOWN", "tcp_established": true, "updated_at": "2019-12-27T18:11:19.117Z", "bgp_state": "bgp_state", "cf_speaker_ip": "192.168.1.1", "cf_speaker_port": 1, "customer_speaker_ip": "192.168.1.1", "customer_speaker_port": 1 }, "created_on": "2017-06-14T00:00:00Z", "description": "Tunnel for ISP X", "health_check": { "direction": "bidirectional", "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "mtu": 0, "ttl": 0 } }, "success": true } ``` ## Delete GRE Tunnel `client.MagicTransit.GRETunnels.Delete(ctx, greTunnelID, params) (*GRETunnelDeleteResponse, error)` **delete** `/accounts/{account_id}/magic/gre_tunnels/{gre_tunnel_id}` Disables and removes a specific static GRE tunnel. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. ### Parameters - `greTunnelID string` Identifier - `params GRETunnelDeleteParams` - `AccountID param.Field[string]` Path param: Identifier - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the response body will be presented using the new object format. Defaults to false. ### Returns - `type GRETunnelDeleteResponse struct{…}` - `Deleted bool` - `DeletedGRETunnel GRETunnelDeleteResponseDeletedGRETunnel` - `ID string` Identifier - `CloudflareGREEndpoint string` The IP address assigned to the Cloudflare side of the GRE tunnel. - `CustomerGREEndpoint string` The IP address assigned to the customer side of the GRE tunnel. - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name string` The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel. - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP GRETunnelDeleteResponseDeletedGRETunnelBGP` - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `BGPStatus GRETunnelDeleteResponseDeletedGRETunnelBGPStatus` - `State GRETunnelDeleteResponseDeletedGRETunnelBGPStatusState` - `const GRETunnelDeleteResponseDeletedGRETunnelBGPStatusStateBGPDown GRETunnelDeleteResponseDeletedGRETunnelBGPStatusState = "BGP_DOWN"` - `const GRETunnelDeleteResponseDeletedGRETunnelBGPStatusStateBGPUp GRETunnelDeleteResponseDeletedGRETunnelBGPStatusState = "BGP_UP"` - `const GRETunnelDeleteResponseDeletedGRETunnelBGPStatusStateBGPEstablishing GRETunnelDeleteResponseDeletedGRETunnelBGPStatusState = "BGP_ESTABLISHING"` - `TCPEstablished bool` - `UpdatedAt Time` - `BGPState string` - `CfSpeakerIP string` - `CfSpeakerPort int64` - `CustomerSpeakerIP string` - `CustomerSpeakerPort int64` - `CreatedOn Time` The date and time the tunnel was created. - `Description string` An optional description of the GRE tunnel. - `HealthCheck GRETunnelDeleteResponseDeletedGRETunnelHealthCheck` - `Direction GRETunnelDeleteResponseDeletedGRETunnelHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const GRETunnelDeleteResponseDeletedGRETunnelHealthCheckDirectionUnidirectional GRETunnelDeleteResponseDeletedGRETunnelHealthCheckDirection = "unidirectional"` - `const GRETunnelDeleteResponseDeletedGRETunnelHealthCheckDirectionBidirectional GRETunnelDeleteResponseDeletedGRETunnelHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target GRETunnelDeleteResponseDeletedGRETunnelHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type GRETunnelDeleteResponseDeletedGRETunnelHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `Mtu int64` Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576. - `TTL int64` Time To Live (TTL) in number of hops of the GRE tunnel. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) greTunnel, err := client.MagicTransit.GRETunnels.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.GRETunnelDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", greTunnel.Deleted) } ``` #### 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": { "deleted": true, "deleted_gre_tunnel": { "id": "c4a7362d577a6c3019a474fd6f485821", "cloudflare_gre_endpoint": "203.0.113.1", "customer_gre_endpoint": "203.0.113.1", "interface_address": "192.0.2.0/31", "name": "GRE_1", "automatic_return_routing": true, "bgp": { "customer_asn": 0, "extra_prefixes": [ "string" ], "md5_key": "md5_key" }, "bgp_status": { "state": "BGP_DOWN", "tcp_established": true, "updated_at": "2019-12-27T18:11:19.117Z", "bgp_state": "bgp_state", "cf_speaker_ip": "192.168.1.1", "cf_speaker_port": 1, "customer_speaker_ip": "192.168.1.1", "customer_speaker_port": 1 }, "created_on": "2017-06-14T00:00:00Z", "description": "Tunnel for ISP X", "health_check": { "direction": "bidirectional", "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "mtu": 0, "ttl": 0 } }, "success": true } ``` ## Update multiple GRE tunnels `client.MagicTransit.GRETunnels.BulkUpdate(ctx, params) (*GRETunnelBulkUpdateResponse, error)` **put** `/accounts/{account_id}/magic/gre_tunnels` Updates multiple GRE tunnels. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. ### Parameters - `params GRETunnelBulkUpdateParams` - `AccountID param.Field[string]` Path param: Identifier - `Body param.Field[unknown]` Body param - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false. ### Returns - `type GRETunnelBulkUpdateResponse struct{…}` - `Modified bool` - `ModifiedGRETunnels []GRETunnelBulkUpdateResponseModifiedGRETunnel` - `ID string` Identifier - `CloudflareGREEndpoint string` The IP address assigned to the Cloudflare side of the GRE tunnel. - `CustomerGREEndpoint string` The IP address assigned to the customer side of the GRE tunnel. - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name string` The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel. - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP GRETunnelBulkUpdateResponseModifiedGRETunnelsBGP` - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `BGPStatus GRETunnelBulkUpdateResponseModifiedGRETunnelsBGPStatus` - `State GRETunnelBulkUpdateResponseModifiedGRETunnelsBGPStatusState` - `const GRETunnelBulkUpdateResponseModifiedGRETunnelsBGPStatusStateBGPDown GRETunnelBulkUpdateResponseModifiedGRETunnelsBGPStatusState = "BGP_DOWN"` - `const GRETunnelBulkUpdateResponseModifiedGRETunnelsBGPStatusStateBGPUp GRETunnelBulkUpdateResponseModifiedGRETunnelsBGPStatusState = "BGP_UP"` - `const GRETunnelBulkUpdateResponseModifiedGRETunnelsBGPStatusStateBGPEstablishing GRETunnelBulkUpdateResponseModifiedGRETunnelsBGPStatusState = "BGP_ESTABLISHING"` - `TCPEstablished bool` - `UpdatedAt Time` - `BGPState string` - `CfSpeakerIP string` - `CfSpeakerPort int64` - `CustomerSpeakerIP string` - `CustomerSpeakerPort int64` - `CreatedOn Time` The date and time the tunnel was created. - `Description string` An optional description of the GRE tunnel. - `HealthCheck GRETunnelBulkUpdateResponseModifiedGRETunnelsHealthCheck` - `Direction GRETunnelBulkUpdateResponseModifiedGRETunnelsHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const GRETunnelBulkUpdateResponseModifiedGRETunnelsHealthCheckDirectionUnidirectional GRETunnelBulkUpdateResponseModifiedGRETunnelsHealthCheckDirection = "unidirectional"` - `const GRETunnelBulkUpdateResponseModifiedGRETunnelsHealthCheckDirectionBidirectional GRETunnelBulkUpdateResponseModifiedGRETunnelsHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target GRETunnelBulkUpdateResponseModifiedGRETunnelsHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type GRETunnelBulkUpdateResponseModifiedGRETunnelsHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `Mtu int64` Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576. - `TTL int64` Time To Live (TTL) in number of hops of the GRE tunnel. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.MagicTransit.GRETunnels.BulkUpdate(context.TODO(), magic_transit.GRETunnelBulkUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: map[string]interface{}{ }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Modified) } ``` #### 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": { "modified": true, "modified_gre_tunnels": [ { "id": "c4a7362d577a6c3019a474fd6f485821", "cloudflare_gre_endpoint": "203.0.113.1", "customer_gre_endpoint": "203.0.113.1", "interface_address": "192.0.2.0/31", "name": "GRE_1", "automatic_return_routing": true, "bgp": { "customer_asn": 0, "extra_prefixes": [ "string" ], "md5_key": "md5_key" }, "bgp_status": { "state": "BGP_DOWN", "tcp_established": true, "updated_at": "2019-12-27T18:11:19.117Z", "bgp_state": "bgp_state", "cf_speaker_ip": "192.168.1.1", "cf_speaker_port": 1, "customer_speaker_ip": "192.168.1.1", "customer_speaker_port": 1 }, "created_on": "2017-06-14T00:00:00Z", "description": "Tunnel for ISP X", "health_check": { "direction": "bidirectional", "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "mtu": 0, "ttl": 0 } ] }, "success": true } ``` # IPSEC Tunnels ## List IPsec tunnels `client.MagicTransit.IPSECTunnels.List(ctx, params) (*IPSECTunnelListResponse, error)` **get** `/accounts/{account_id}/magic/ipsec_tunnels` Lists IPsec tunnels associated with an account. ### Parameters - `params IPSECTunnelListParams` - `AccountID param.Field[string]` Path param: Identifier - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the response body will be presented using the new object format. Defaults to false. ### Returns - `type IPSECTunnelListResponse struct{…}` - `IPSECTunnels []IPSECTunnelListResponseIPSECTunnel` - `ID string` Identifier - `CloudflareEndpoint string` The IP address assigned to the Cloudflare side of the IPsec tunnel. - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name string` The name of the IPsec tunnel. The name cannot share a name with other tunnels. - `AllowNullCipher bool` When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel (Phase 2). - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP IPSECTunnelListResponseIPSECTunnelsBGP` - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `BGPStatus IPSECTunnelListResponseIPSECTunnelsBGPStatus` - `State IPSECTunnelListResponseIPSECTunnelsBGPStatusState` - `const IPSECTunnelListResponseIPSECTunnelsBGPStatusStateBGPDown IPSECTunnelListResponseIPSECTunnelsBGPStatusState = "BGP_DOWN"` - `const IPSECTunnelListResponseIPSECTunnelsBGPStatusStateBGPUp IPSECTunnelListResponseIPSECTunnelsBGPStatusState = "BGP_UP"` - `const IPSECTunnelListResponseIPSECTunnelsBGPStatusStateBGPEstablishing IPSECTunnelListResponseIPSECTunnelsBGPStatusState = "BGP_ESTABLISHING"` - `TCPEstablished bool` - `UpdatedAt Time` - `BGPState string` - `CfSpeakerIP string` - `CfSpeakerPort int64` - `CustomerSpeakerIP string` - `CustomerSpeakerPort int64` - `CreatedOn Time` The date and time the tunnel was created. - `CustomRemoteIdentities IPSECTunnelListResponseIPSECTunnelsCustomRemoteIdentities` - `FqdnID string` A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The generated IKE IDs can still be used even if this custom value is specified. Must be of the form `..custom.ipsec.cloudflare.com`. This custom ID does not need to be unique. Two IPsec tunnels may have the same custom fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels cannot have the same cloudflare_endpoint. - `CustomerEndpoint string` The IP address assigned to the customer side of the IPsec tunnel. Not required, but must be set for proactive traceroutes to work. - `Description string` An optional description forthe IPsec tunnel. - `HealthCheck IPSECTunnelListResponseIPSECTunnelsHealthCheck` - `Direction IPSECTunnelListResponseIPSECTunnelsHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const IPSECTunnelListResponseIPSECTunnelsHealthCheckDirectionUnidirectional IPSECTunnelListResponseIPSECTunnelsHealthCheckDirection = "unidirectional"` - `const IPSECTunnelListResponseIPSECTunnelsHealthCheckDirectionBidirectional IPSECTunnelListResponseIPSECTunnelsHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target IPSECTunnelListResponseIPSECTunnelsHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type IPSECTunnelListResponseIPSECTunnelsHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `PSKMetadata PSKMetadata` The PSK metadata that includes when the PSK was generated. - `LastGeneratedOn Time` The date and time the tunnel was last modified. - `ReplayProtection bool` If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) ipsecTunnels, err := client.MagicTransit.IPSECTunnels.List(context.TODO(), magic_transit.IPSECTunnelListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", ipsecTunnels.IPSECTunnels) } ``` #### 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": { "ipsec_tunnels": [ { "id": "c4a7362d577a6c3019a474fd6f485821", "cloudflare_endpoint": "203.0.113.1", "interface_address": "192.0.2.0/31", "name": "IPsec_1", "allow_null_cipher": true, "automatic_return_routing": true, "bgp": { "customer_asn": 0, "extra_prefixes": [ "string" ], "md5_key": "md5_key" }, "bgp_status": { "state": "BGP_DOWN", "tcp_established": true, "updated_at": "2019-12-27T18:11:19.117Z", "bgp_state": "bgp_state", "cf_speaker_ip": "192.168.1.1", "cf_speaker_port": 1, "customer_speaker_ip": "192.168.1.1", "customer_speaker_port": 1 }, "created_on": "2017-06-14T00:00:00Z", "custom_remote_identities": { "fqdn_id": "fqdn_id" }, "customer_endpoint": "203.0.113.1", "description": "Tunnel for ISP X", "health_check": { "direction": "bidirectional", "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "psk_metadata": { "last_generated_on": "2017-06-14T05:20:00Z" }, "replay_protection": false } ] }, "success": true } ``` ## List IPsec tunnel details `client.MagicTransit.IPSECTunnels.Get(ctx, ipsecTunnelID, params) (*IPSECTunnelGetResponse, error)` **get** `/accounts/{account_id}/magic/ipsec_tunnels/{ipsec_tunnel_id}` Lists details for a specific IPsec tunnel. ### Parameters - `ipsecTunnelID string` Identifier - `params IPSECTunnelGetParams` - `AccountID param.Field[string]` Path param: Identifier - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the response body will be presented using the new object format. Defaults to false. ### Returns - `type IPSECTunnelGetResponse struct{…}` - `IPSECTunnel IPSECTunnelGetResponseIPSECTunnel` - `ID string` Identifier - `CloudflareEndpoint string` The IP address assigned to the Cloudflare side of the IPsec tunnel. - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name string` The name of the IPsec tunnel. The name cannot share a name with other tunnels. - `AllowNullCipher bool` When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel (Phase 2). - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP IPSECTunnelGetResponseIPSECTunnelBGP` - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `BGPStatus IPSECTunnelGetResponseIPSECTunnelBGPStatus` - `State IPSECTunnelGetResponseIPSECTunnelBGPStatusState` - `const IPSECTunnelGetResponseIPSECTunnelBGPStatusStateBGPDown IPSECTunnelGetResponseIPSECTunnelBGPStatusState = "BGP_DOWN"` - `const IPSECTunnelGetResponseIPSECTunnelBGPStatusStateBGPUp IPSECTunnelGetResponseIPSECTunnelBGPStatusState = "BGP_UP"` - `const IPSECTunnelGetResponseIPSECTunnelBGPStatusStateBGPEstablishing IPSECTunnelGetResponseIPSECTunnelBGPStatusState = "BGP_ESTABLISHING"` - `TCPEstablished bool` - `UpdatedAt Time` - `BGPState string` - `CfSpeakerIP string` - `CfSpeakerPort int64` - `CustomerSpeakerIP string` - `CustomerSpeakerPort int64` - `CreatedOn Time` The date and time the tunnel was created. - `CustomRemoteIdentities IPSECTunnelGetResponseIPSECTunnelCustomRemoteIdentities` - `FqdnID string` A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The generated IKE IDs can still be used even if this custom value is specified. Must be of the form `..custom.ipsec.cloudflare.com`. This custom ID does not need to be unique. Two IPsec tunnels may have the same custom fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels cannot have the same cloudflare_endpoint. - `CustomerEndpoint string` The IP address assigned to the customer side of the IPsec tunnel. Not required, but must be set for proactive traceroutes to work. - `Description string` An optional description forthe IPsec tunnel. - `HealthCheck IPSECTunnelGetResponseIPSECTunnelHealthCheck` - `Direction IPSECTunnelGetResponseIPSECTunnelHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const IPSECTunnelGetResponseIPSECTunnelHealthCheckDirectionUnidirectional IPSECTunnelGetResponseIPSECTunnelHealthCheckDirection = "unidirectional"` - `const IPSECTunnelGetResponseIPSECTunnelHealthCheckDirectionBidirectional IPSECTunnelGetResponseIPSECTunnelHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target IPSECTunnelGetResponseIPSECTunnelHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type IPSECTunnelGetResponseIPSECTunnelHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `PSKMetadata PSKMetadata` The PSK metadata that includes when the PSK was generated. - `LastGeneratedOn Time` The date and time the tunnel was last modified. - `ReplayProtection bool` If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) ipsecTunnel, err := client.MagicTransit.IPSECTunnels.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.IPSECTunnelGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", ipsecTunnel.IPSECTunnel) } ``` #### 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": { "ipsec_tunnel": { "id": "c4a7362d577a6c3019a474fd6f485821", "cloudflare_endpoint": "203.0.113.1", "interface_address": "192.0.2.0/31", "name": "IPsec_1", "allow_null_cipher": true, "automatic_return_routing": true, "bgp": { "customer_asn": 0, "extra_prefixes": [ "string" ], "md5_key": "md5_key" }, "bgp_status": { "state": "BGP_DOWN", "tcp_established": true, "updated_at": "2019-12-27T18:11:19.117Z", "bgp_state": "bgp_state", "cf_speaker_ip": "192.168.1.1", "cf_speaker_port": 1, "customer_speaker_ip": "192.168.1.1", "customer_speaker_port": 1 }, "created_on": "2017-06-14T00:00:00Z", "custom_remote_identities": { "fqdn_id": "fqdn_id" }, "customer_endpoint": "203.0.113.1", "description": "Tunnel for ISP X", "health_check": { "direction": "bidirectional", "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "psk_metadata": { "last_generated_on": "2017-06-14T05:20:00Z" }, "replay_protection": false } }, "success": true } ``` ## Create an IPsec tunnel `client.MagicTransit.IPSECTunnels.New(ctx, params) (*IPSECTunnelNewResponse, error)` **post** `/accounts/{account_id}/magic/ipsec_tunnels` Creates a new IPsec tunnel associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. ### Parameters - `params IPSECTunnelNewParams` - `AccountID param.Field[string]` Path param: Identifier - `CloudflareEndpoint param.Field[string]` Body param: The IP address assigned to the Cloudflare side of the IPsec tunnel. - `InterfaceAddress param.Field[string]` Body param: A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name param.Field[string]` Body param: The name of the IPsec tunnel. The name cannot share a name with other tunnels. - `AutomaticReturnRouting param.Field[bool]` Body param: True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP param.Field[IPSECTunnelNewParamsBGP]` Body param - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `CustomRemoteIdentities param.Field[IPSECTunnelNewParamsCustomRemoteIdentities]` Body param - `FqdnID string` A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The generated IKE IDs can still be used even if this custom value is specified. Must be of the form `..custom.ipsec.cloudflare.com`. This custom ID does not need to be unique. Two IPsec tunnels may have the same custom fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels cannot have the same cloudflare_endpoint. - `CustomerEndpoint param.Field[string]` Body param: The IP address assigned to the customer side of the IPsec tunnel. Not required, but must be set for proactive traceroutes to work. - `Description param.Field[string]` Body param: An optional description forthe IPsec tunnel. - `HealthCheck param.Field[IPSECTunnelNewParamsHealthCheck]` Body param - `Direction IPSECTunnelNewParamsHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const IPSECTunnelNewParamsHealthCheckDirectionUnidirectional IPSECTunnelNewParamsHealthCheckDirection = "unidirectional"` - `const IPSECTunnelNewParamsHealthCheckDirectionBidirectional IPSECTunnelNewParamsHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target IPSECTunnelNewParamsHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type IPSECTunnelNewParamsHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 param.Field[string]` Body param: A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `PSK param.Field[string]` Body param: A randomly generated or provided string for use in the IPsec tunnel. - `ReplayProtection param.Field[bool]` Body param: If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction. - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false. ### Returns - `type IPSECTunnelNewResponse struct{…}` - `ID string` Identifier - `CloudflareEndpoint string` The IP address assigned to the Cloudflare side of the IPsec tunnel. - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name string` The name of the IPsec tunnel. The name cannot share a name with other tunnels. - `AllowNullCipher bool` When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel (Phase 2). - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP IPSECTunnelNewResponseBGP` - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `BGPStatus IPSECTunnelNewResponseBGPStatus` - `State IPSECTunnelNewResponseBGPStatusState` - `const IPSECTunnelNewResponseBGPStatusStateBGPDown IPSECTunnelNewResponseBGPStatusState = "BGP_DOWN"` - `const IPSECTunnelNewResponseBGPStatusStateBGPUp IPSECTunnelNewResponseBGPStatusState = "BGP_UP"` - `const IPSECTunnelNewResponseBGPStatusStateBGPEstablishing IPSECTunnelNewResponseBGPStatusState = "BGP_ESTABLISHING"` - `TCPEstablished bool` - `UpdatedAt Time` - `BGPState string` - `CfSpeakerIP string` - `CfSpeakerPort int64` - `CustomerSpeakerIP string` - `CustomerSpeakerPort int64` - `CreatedOn Time` The date and time the tunnel was created. - `CustomRemoteIdentities IPSECTunnelNewResponseCustomRemoteIdentities` - `FqdnID string` A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The generated IKE IDs can still be used even if this custom value is specified. Must be of the form `..custom.ipsec.cloudflare.com`. This custom ID does not need to be unique. Two IPsec tunnels may have the same custom fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels cannot have the same cloudflare_endpoint. - `CustomerEndpoint string` The IP address assigned to the customer side of the IPsec tunnel. Not required, but must be set for proactive traceroutes to work. - `Description string` An optional description forthe IPsec tunnel. - `HealthCheck IPSECTunnelNewResponseHealthCheck` - `Direction IPSECTunnelNewResponseHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const IPSECTunnelNewResponseHealthCheckDirectionUnidirectional IPSECTunnelNewResponseHealthCheckDirection = "unidirectional"` - `const IPSECTunnelNewResponseHealthCheckDirectionBidirectional IPSECTunnelNewResponseHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target IPSECTunnelNewResponseHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type IPSECTunnelNewResponseHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `PSKMetadata PSKMetadata` The PSK metadata that includes when the PSK was generated. - `LastGeneratedOn Time` The date and time the tunnel was last modified. - `ReplayProtection bool` If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) ipsecTunnel, err := client.MagicTransit.IPSECTunnels.New(context.TODO(), magic_transit.IPSECTunnelNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), CloudflareEndpoint: cloudflare.F("203.0.113.1"), InterfaceAddress: cloudflare.F("192.0.2.0/31"), Name: cloudflare.F("IPsec_1"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", ipsecTunnel.ID) } ``` #### 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": { "id": "c4a7362d577a6c3019a474fd6f485821", "cloudflare_endpoint": "203.0.113.1", "interface_address": "192.0.2.0/31", "name": "IPsec_1", "allow_null_cipher": true, "automatic_return_routing": true, "bgp": { "customer_asn": 0, "extra_prefixes": [ "string" ], "md5_key": "md5_key" }, "bgp_status": { "state": "BGP_DOWN", "tcp_established": true, "updated_at": "2019-12-27T18:11:19.117Z", "bgp_state": "bgp_state", "cf_speaker_ip": "192.168.1.1", "cf_speaker_port": 1, "customer_speaker_ip": "192.168.1.1", "customer_speaker_port": 1 }, "created_on": "2017-06-14T00:00:00Z", "custom_remote_identities": { "fqdn_id": "fqdn_id" }, "customer_endpoint": "203.0.113.1", "description": "Tunnel for ISP X", "health_check": { "direction": "bidirectional", "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "psk_metadata": { "last_generated_on": "2017-06-14T05:20:00Z" }, "replay_protection": false }, "success": true } ``` ## Update IPsec Tunnel `client.MagicTransit.IPSECTunnels.Update(ctx, ipsecTunnelID, params) (*IPSECTunnelUpdateResponse, error)` **put** `/accounts/{account_id}/magic/ipsec_tunnels/{ipsec_tunnel_id}` Updates a specific IPsec tunnel associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. ### Parameters - `ipsecTunnelID string` Identifier - `params IPSECTunnelUpdateParams` - `AccountID param.Field[string]` Path param: Identifier - `CloudflareEndpoint param.Field[string]` Body param: The IP address assigned to the Cloudflare side of the IPsec tunnel. - `InterfaceAddress param.Field[string]` Body param: A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name param.Field[string]` Body param: The name of the IPsec tunnel. The name cannot share a name with other tunnels. - `AutomaticReturnRouting param.Field[bool]` Body param: True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP param.Field[IPSECTunnelUpdateParamsBGP]` Body param - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `CustomRemoteIdentities param.Field[IPSECTunnelUpdateParamsCustomRemoteIdentities]` Body param - `FqdnID string` A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The generated IKE IDs can still be used even if this custom value is specified. Must be of the form `..custom.ipsec.cloudflare.com`. This custom ID does not need to be unique. Two IPsec tunnels may have the same custom fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels cannot have the same cloudflare_endpoint. - `CustomerEndpoint param.Field[string]` Body param: The IP address assigned to the customer side of the IPsec tunnel. Not required, but must be set for proactive traceroutes to work. - `Description param.Field[string]` Body param: An optional description forthe IPsec tunnel. - `HealthCheck param.Field[IPSECTunnelUpdateParamsHealthCheck]` Body param - `Direction IPSECTunnelUpdateParamsHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const IPSECTunnelUpdateParamsHealthCheckDirectionUnidirectional IPSECTunnelUpdateParamsHealthCheckDirection = "unidirectional"` - `const IPSECTunnelUpdateParamsHealthCheckDirectionBidirectional IPSECTunnelUpdateParamsHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target IPSECTunnelUpdateParamsHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type IPSECTunnelUpdateParamsHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 param.Field[string]` Body param: A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `PSK param.Field[string]` Body param: A randomly generated or provided string for use in the IPsec tunnel. - `ReplayProtection param.Field[bool]` Body param: If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction. - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false. ### Returns - `type IPSECTunnelUpdateResponse struct{…}` - `Modified bool` - `ModifiedIPSECTunnel IPSECTunnelUpdateResponseModifiedIPSECTunnel` - `ID string` Identifier - `CloudflareEndpoint string` The IP address assigned to the Cloudflare side of the IPsec tunnel. - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name string` The name of the IPsec tunnel. The name cannot share a name with other tunnels. - `AllowNullCipher bool` When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel (Phase 2). - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP IPSECTunnelUpdateResponseModifiedIPSECTunnelBGP` - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `BGPStatus IPSECTunnelUpdateResponseModifiedIPSECTunnelBGPStatus` - `State IPSECTunnelUpdateResponseModifiedIPSECTunnelBGPStatusState` - `const IPSECTunnelUpdateResponseModifiedIPSECTunnelBGPStatusStateBGPDown IPSECTunnelUpdateResponseModifiedIPSECTunnelBGPStatusState = "BGP_DOWN"` - `const IPSECTunnelUpdateResponseModifiedIPSECTunnelBGPStatusStateBGPUp IPSECTunnelUpdateResponseModifiedIPSECTunnelBGPStatusState = "BGP_UP"` - `const IPSECTunnelUpdateResponseModifiedIPSECTunnelBGPStatusStateBGPEstablishing IPSECTunnelUpdateResponseModifiedIPSECTunnelBGPStatusState = "BGP_ESTABLISHING"` - `TCPEstablished bool` - `UpdatedAt Time` - `BGPState string` - `CfSpeakerIP string` - `CfSpeakerPort int64` - `CustomerSpeakerIP string` - `CustomerSpeakerPort int64` - `CreatedOn Time` The date and time the tunnel was created. - `CustomRemoteIdentities IPSECTunnelUpdateResponseModifiedIPSECTunnelCustomRemoteIdentities` - `FqdnID string` A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The generated IKE IDs can still be used even if this custom value is specified. Must be of the form `..custom.ipsec.cloudflare.com`. This custom ID does not need to be unique. Two IPsec tunnels may have the same custom fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels cannot have the same cloudflare_endpoint. - `CustomerEndpoint string` The IP address assigned to the customer side of the IPsec tunnel. Not required, but must be set for proactive traceroutes to work. - `Description string` An optional description forthe IPsec tunnel. - `HealthCheck IPSECTunnelUpdateResponseModifiedIPSECTunnelHealthCheck` - `Direction IPSECTunnelUpdateResponseModifiedIPSECTunnelHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const IPSECTunnelUpdateResponseModifiedIPSECTunnelHealthCheckDirectionUnidirectional IPSECTunnelUpdateResponseModifiedIPSECTunnelHealthCheckDirection = "unidirectional"` - `const IPSECTunnelUpdateResponseModifiedIPSECTunnelHealthCheckDirectionBidirectional IPSECTunnelUpdateResponseModifiedIPSECTunnelHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target IPSECTunnelUpdateResponseModifiedIPSECTunnelHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type IPSECTunnelUpdateResponseModifiedIPSECTunnelHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `PSKMetadata PSKMetadata` The PSK metadata that includes when the PSK was generated. - `LastGeneratedOn Time` The date and time the tunnel was last modified. - `ReplayProtection bool` If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) ipsecTunnel, err := client.MagicTransit.IPSECTunnels.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.IPSECTunnelUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), CloudflareEndpoint: cloudflare.F("203.0.113.1"), InterfaceAddress: cloudflare.F("192.0.2.0/31"), Name: cloudflare.F("IPsec_1"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", ipsecTunnel.Modified) } ``` #### 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": { "modified": true, "modified_ipsec_tunnel": { "id": "c4a7362d577a6c3019a474fd6f485821", "cloudflare_endpoint": "203.0.113.1", "interface_address": "192.0.2.0/31", "name": "IPsec_1", "allow_null_cipher": true, "automatic_return_routing": true, "bgp": { "customer_asn": 0, "extra_prefixes": [ "string" ], "md5_key": "md5_key" }, "bgp_status": { "state": "BGP_DOWN", "tcp_established": true, "updated_at": "2019-12-27T18:11:19.117Z", "bgp_state": "bgp_state", "cf_speaker_ip": "192.168.1.1", "cf_speaker_port": 1, "customer_speaker_ip": "192.168.1.1", "customer_speaker_port": 1 }, "created_on": "2017-06-14T00:00:00Z", "custom_remote_identities": { "fqdn_id": "fqdn_id" }, "customer_endpoint": "203.0.113.1", "description": "Tunnel for ISP X", "health_check": { "direction": "bidirectional", "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "psk_metadata": { "last_generated_on": "2017-06-14T05:20:00Z" }, "replay_protection": false } }, "success": true } ``` ## Delete IPsec Tunnel `client.MagicTransit.IPSECTunnels.Delete(ctx, ipsecTunnelID, params) (*IPSECTunnelDeleteResponse, error)` **delete** `/accounts/{account_id}/magic/ipsec_tunnels/{ipsec_tunnel_id}` Disables and removes a specific static IPsec Tunnel associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. ### Parameters - `ipsecTunnelID string` Identifier - `params IPSECTunnelDeleteParams` - `AccountID param.Field[string]` Path param: Identifier - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the response body will be presented using the new object format. Defaults to false. ### Returns - `type IPSECTunnelDeleteResponse struct{…}` - `Deleted bool` - `DeletedIPSECTunnel IPSECTunnelDeleteResponseDeletedIPSECTunnel` - `ID string` Identifier - `CloudflareEndpoint string` The IP address assigned to the Cloudflare side of the IPsec tunnel. - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name string` The name of the IPsec tunnel. The name cannot share a name with other tunnels. - `AllowNullCipher bool` When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel (Phase 2). - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP IPSECTunnelDeleteResponseDeletedIPSECTunnelBGP` - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `BGPStatus IPSECTunnelDeleteResponseDeletedIPSECTunnelBGPStatus` - `State IPSECTunnelDeleteResponseDeletedIPSECTunnelBGPStatusState` - `const IPSECTunnelDeleteResponseDeletedIPSECTunnelBGPStatusStateBGPDown IPSECTunnelDeleteResponseDeletedIPSECTunnelBGPStatusState = "BGP_DOWN"` - `const IPSECTunnelDeleteResponseDeletedIPSECTunnelBGPStatusStateBGPUp IPSECTunnelDeleteResponseDeletedIPSECTunnelBGPStatusState = "BGP_UP"` - `const IPSECTunnelDeleteResponseDeletedIPSECTunnelBGPStatusStateBGPEstablishing IPSECTunnelDeleteResponseDeletedIPSECTunnelBGPStatusState = "BGP_ESTABLISHING"` - `TCPEstablished bool` - `UpdatedAt Time` - `BGPState string` - `CfSpeakerIP string` - `CfSpeakerPort int64` - `CustomerSpeakerIP string` - `CustomerSpeakerPort int64` - `CreatedOn Time` The date and time the tunnel was created. - `CustomRemoteIdentities IPSECTunnelDeleteResponseDeletedIPSECTunnelCustomRemoteIdentities` - `FqdnID string` A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The generated IKE IDs can still be used even if this custom value is specified. Must be of the form `..custom.ipsec.cloudflare.com`. This custom ID does not need to be unique. Two IPsec tunnels may have the same custom fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels cannot have the same cloudflare_endpoint. - `CustomerEndpoint string` The IP address assigned to the customer side of the IPsec tunnel. Not required, but must be set for proactive traceroutes to work. - `Description string` An optional description forthe IPsec tunnel. - `HealthCheck IPSECTunnelDeleteResponseDeletedIPSECTunnelHealthCheck` - `Direction IPSECTunnelDeleteResponseDeletedIPSECTunnelHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const IPSECTunnelDeleteResponseDeletedIPSECTunnelHealthCheckDirectionUnidirectional IPSECTunnelDeleteResponseDeletedIPSECTunnelHealthCheckDirection = "unidirectional"` - `const IPSECTunnelDeleteResponseDeletedIPSECTunnelHealthCheckDirectionBidirectional IPSECTunnelDeleteResponseDeletedIPSECTunnelHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target IPSECTunnelDeleteResponseDeletedIPSECTunnelHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type IPSECTunnelDeleteResponseDeletedIPSECTunnelHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `PSKMetadata PSKMetadata` The PSK metadata that includes when the PSK was generated. - `LastGeneratedOn Time` The date and time the tunnel was last modified. - `ReplayProtection bool` If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) ipsecTunnel, err := client.MagicTransit.IPSECTunnels.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.IPSECTunnelDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", ipsecTunnel.Deleted) } ``` #### 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": { "deleted": true, "deleted_ipsec_tunnel": { "id": "c4a7362d577a6c3019a474fd6f485821", "cloudflare_endpoint": "203.0.113.1", "interface_address": "192.0.2.0/31", "name": "IPsec_1", "allow_null_cipher": true, "automatic_return_routing": true, "bgp": { "customer_asn": 0, "extra_prefixes": [ "string" ], "md5_key": "md5_key" }, "bgp_status": { "state": "BGP_DOWN", "tcp_established": true, "updated_at": "2019-12-27T18:11:19.117Z", "bgp_state": "bgp_state", "cf_speaker_ip": "192.168.1.1", "cf_speaker_port": 1, "customer_speaker_ip": "192.168.1.1", "customer_speaker_port": 1 }, "created_on": "2017-06-14T00:00:00Z", "custom_remote_identities": { "fqdn_id": "fqdn_id" }, "customer_endpoint": "203.0.113.1", "description": "Tunnel for ISP X", "health_check": { "direction": "bidirectional", "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "psk_metadata": { "last_generated_on": "2017-06-14T05:20:00Z" }, "replay_protection": false } }, "success": true } ``` ## Update multiple IPsec tunnels `client.MagicTransit.IPSECTunnels.BulkUpdate(ctx, params) (*IPSECTunnelBulkUpdateResponse, error)` **put** `/accounts/{account_id}/magic/ipsec_tunnels` Update multiple IPsec tunnels associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. ### Parameters - `params IPSECTunnelBulkUpdateParams` - `AccountID param.Field[string]` Path param: Identifier - `Body param.Field[unknown]` Body param - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false. ### Returns - `type IPSECTunnelBulkUpdateResponse struct{…}` - `Modified bool` - `ModifiedIPSECTunnels []IPSECTunnelBulkUpdateResponseModifiedIPSECTunnel` - `ID string` Identifier - `CloudflareEndpoint string` The IP address assigned to the Cloudflare side of the IPsec tunnel. - `InterfaceAddress string` A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - `Name string` The name of the IPsec tunnel. The name cannot share a name with other tunnels. - `AllowNullCipher bool` When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel (Phase 2). - `AutomaticReturnRouting bool` True if automatic stateful return routing should be enabled for a tunnel, false otherwise. - `BGP IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsBGP` - `CustomerASN int64` ASN used on the customer end of the BGP session - `ExtraPrefixes []string` Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table. - `Md5Key string` MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= |` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected. - `BGPStatus IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsBGPStatus` - `State IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsBGPStatusState` - `const IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsBGPStatusStateBGPDown IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsBGPStatusState = "BGP_DOWN"` - `const IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsBGPStatusStateBGPUp IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsBGPStatusState = "BGP_UP"` - `const IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsBGPStatusStateBGPEstablishing IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsBGPStatusState = "BGP_ESTABLISHING"` - `TCPEstablished bool` - `UpdatedAt Time` - `BGPState string` - `CfSpeakerIP string` - `CfSpeakerPort int64` - `CustomerSpeakerIP string` - `CustomerSpeakerPort int64` - `CreatedOn Time` The date and time the tunnel was created. - `CustomRemoteIdentities IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsCustomRemoteIdentities` - `FqdnID string` A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The generated IKE IDs can still be used even if this custom value is specified. Must be of the form `..custom.ipsec.cloudflare.com`. This custom ID does not need to be unique. Two IPsec tunnels may have the same custom fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels cannot have the same cloudflare_endpoint. - `CustomerEndpoint string` The IP address assigned to the customer side of the IPsec tunnel. Not required, but must be set for proactive traceroutes to work. - `Description string` An optional description forthe IPsec tunnel. - `HealthCheck IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsHealthCheck` - `Direction IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsHealthCheckDirection` The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel. - `const IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsHealthCheckDirectionUnidirectional IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsHealthCheckDirection = "unidirectional"` - `const IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsHealthCheckDirectionBidirectional IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsHealthCheckDirection = "bidirectional"` - `Enabled bool` Determines whether to run healthchecks for a tunnel. - `Rate HealthCheckRate` How frequent the health check is run. The default value is `mid`. - `const HealthCheckRateLow HealthCheckRate = "low"` - `const HealthCheckRateMid HealthCheckRate = "mid"` - `const HealthCheckRateHigh HealthCheckRate = "high"` - `Target IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsHealthCheckTargetUnion` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false. - `type IPSECTunnelBulkUpdateResponseModifiedIPSECTunnelsHealthCheckTargetMagicHealthCheckTarget struct{…}` The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to `customer_gre_endpoint address`. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. - `Effective string` The effective health check target. If 'saved' is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests. - `Saved string` The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used. - `UnionString` - `Type HealthCheckType` The type of healthcheck to run, reply or request. The default value is `reply`. - `const HealthCheckTypeReply HealthCheckType = "reply"` - `const HealthCheckTypeRequest HealthCheckType = "request"` - `InterfaceAddress6 string` A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127 - `ModifiedOn Time` The date and time the tunnel was last modified. - `PSKMetadata PSKMetadata` The PSK metadata that includes when the PSK was generated. - `LastGeneratedOn Time` The date and time the tunnel was last modified. - `ReplayProtection bool` If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.MagicTransit.IPSECTunnels.BulkUpdate(context.TODO(), magic_transit.IPSECTunnelBulkUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: map[string]interface{}{ }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Modified) } ``` #### 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": { "modified": true, "modified_ipsec_tunnels": [ { "id": "c4a7362d577a6c3019a474fd6f485821", "cloudflare_endpoint": "203.0.113.1", "interface_address": "192.0.2.0/31", "name": "IPsec_1", "allow_null_cipher": true, "automatic_return_routing": true, "bgp": { "customer_asn": 0, "extra_prefixes": [ "string" ], "md5_key": "md5_key" }, "bgp_status": { "state": "BGP_DOWN", "tcp_established": true, "updated_at": "2019-12-27T18:11:19.117Z", "bgp_state": "bgp_state", "cf_speaker_ip": "192.168.1.1", "cf_speaker_port": 1, "customer_speaker_ip": "192.168.1.1", "customer_speaker_port": 1 }, "created_on": "2017-06-14T00:00:00Z", "custom_remote_identities": { "fqdn_id": "fqdn_id" }, "customer_endpoint": "203.0.113.1", "description": "Tunnel for ISP X", "health_check": { "direction": "bidirectional", "enabled": true, "rate": "low", "target": { "effective": "203.0.113.1", "saved": "203.0.113.1" }, "type": "request" }, "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127", "modified_on": "2017-06-14T05:20:00Z", "psk_metadata": { "last_generated_on": "2017-06-14T05:20:00Z" }, "replay_protection": false } ] }, "success": true } ``` ## Generate Pre Shared Key (PSK) for IPsec tunnels `client.MagicTransit.IPSECTunnels.PSKGenerate(ctx, ipsecTunnelID, params) (*IPSECTunnelPSKGenerateResponse, error)` **post** `/accounts/{account_id}/magic/ipsec_tunnels/{ipsec_tunnel_id}/psk_generate` Generates a Pre Shared Key for a specific IPsec tunnel used in the IKE session. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. After a PSK is generated, the PSK is immediately persisted to Cloudflare's edge and cannot be retrieved later. Note the PSK in a safe place. ### Parameters - `ipsecTunnelID string` Identifier - `params IPSECTunnelPSKGenerateParams` - `AccountID param.Field[string]` Path param: Identifier - `Body param.Field[unknown]` Body param ### Returns - `type IPSECTunnelPSKGenerateResponse struct{…}` - `IPSECTunnelID string` Identifier - `PSK string` A randomly generated or provided string for use in the IPsec tunnel. - `PSKMetadata PSKMetadata` The PSK metadata that includes when the PSK was generated. - `LastGeneratedOn Time` The date and time the tunnel was last modified. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.MagicTransit.IPSECTunnels.PSKGenerate( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.IPSECTunnelPSKGenerateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: map[string]interface{}{ }, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.IPSECTunnelID) } ``` #### 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": { "ipsec_tunnel_id": "023e105f4ecef8ad9ca31a8372d0c353", "psk": "O3bwKSjnaoCxDoUxjcq4Rk8ZKkezQUiy", "psk_metadata": { "last_generated_on": "2017-06-14T05:20:00Z" } }, "success": true } ``` ## Domain Types ### PSK Metadata - `type PSKMetadata struct{…}` The PSK metadata that includes when the PSK was generated. - `LastGeneratedOn Time` The date and time the tunnel was last modified. # Routes ## List Routes `client.MagicTransit.Routes.List(ctx, query) (*RouteListResponse, error)` **get** `/accounts/{account_id}/magic/routes` List all Magic static routes. ### Parameters - `query RouteListParams` - `AccountID param.Field[string]` Identifier ### Returns - `type RouteListResponse struct{…}` - `Routes []RouteListResponseRoute` - `ID string` Identifier - `Nexthop string` The next-hop IP Address for the static route. - `Prefix string` IP Prefix in Classless Inter-Domain Routing format. - `Priority int64` Priority of the static route. - `CreatedOn Time` When the route was created. - `Description string` An optional human provided description of the static route. - `ModifiedOn Time` When the route was last modified. - `Scope Scope` Used only for ECMP routes. - `ColoNames []string` List of colo names for the ECMP scope. - `ColoRegions []string` List of colo regions for the ECMP scope. - `Weight int64` Optional weight of the ECMP scope - if provided. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) routes, err := client.MagicTransit.Routes.List(context.TODO(), magic_transit.RouteListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", routes.Routes) } ``` #### 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": { "routes": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "nexthop": "203.0.113.1", "prefix": "192.0.2.0/24", "priority": 0, "created_on": "2017-06-14T00:00:00Z", "description": "New route for new prefix 203.0.113.1", "modified_on": "2017-06-14T05:20:00Z", "scope": { "colo_names": [ "den01" ], "colo_regions": [ "APAC" ] }, "weight": 0 } ] }, "success": true } ``` ## Route Details `client.MagicTransit.Routes.Get(ctx, routeID, query) (*RouteGetResponse, error)` **get** `/accounts/{account_id}/magic/routes/{route_id}` Get a specific Magic static route. ### Parameters - `routeID string` Identifier - `query RouteGetParams` - `AccountID param.Field[string]` Identifier ### Returns - `type RouteGetResponse struct{…}` - `Route RouteGetResponseRoute` - `ID string` Identifier - `Nexthop string` The next-hop IP Address for the static route. - `Prefix string` IP Prefix in Classless Inter-Domain Routing format. - `Priority int64` Priority of the static route. - `CreatedOn Time` When the route was created. - `Description string` An optional human provided description of the static route. - `ModifiedOn Time` When the route was last modified. - `Scope Scope` Used only for ECMP routes. - `ColoNames []string` List of colo names for the ECMP scope. - `ColoRegions []string` List of colo regions for the ECMP scope. - `Weight int64` Optional weight of the ECMP scope - if provided. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) route, err := client.MagicTransit.Routes.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.RouteGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", route.Route) } ``` #### 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": { "route": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "nexthop": "203.0.113.1", "prefix": "192.0.2.0/24", "priority": 0, "created_on": "2017-06-14T00:00:00Z", "description": "New route for new prefix 203.0.113.1", "modified_on": "2017-06-14T05:20:00Z", "scope": { "colo_names": [ "den01" ], "colo_regions": [ "APAC" ] }, "weight": 0 } }, "success": true } ``` ## Create a Route `client.MagicTransit.Routes.New(ctx, params) (*RouteNewResponse, error)` **post** `/accounts/{account_id}/magic/routes` Creates a new Magic static route. Use `?validate_only=true` as an optional query parameter to run validation only without persisting changes. ### Parameters - `params RouteNewParams` - `AccountID param.Field[string]` Path param: Identifier - `Nexthop param.Field[string]` Body param: The next-hop IP Address for the static route. - `Prefix param.Field[string]` Body param: IP Prefix in Classless Inter-Domain Routing format. - `Priority param.Field[int64]` Body param: Priority of the static route. - `Description param.Field[string]` Body param: An optional human provided description of the static route. - `Scope param.Field[Scope]` Body param: Used only for ECMP routes. - `Weight param.Field[int64]` Body param: Optional weight of the ECMP scope - if provided. ### Returns - `type RouteNewResponse struct{…}` - `ID string` Identifier - `Nexthop string` The next-hop IP Address for the static route. - `Prefix string` IP Prefix in Classless Inter-Domain Routing format. - `Priority int64` Priority of the static route. - `CreatedOn Time` When the route was created. - `Description string` An optional human provided description of the static route. - `ModifiedOn Time` When the route was last modified. - `Scope Scope` Used only for ECMP routes. - `ColoNames []string` List of colo names for the ECMP scope. - `ColoRegions []string` List of colo regions for the ECMP scope. - `Weight int64` Optional weight of the ECMP scope - if provided. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) route, err := client.MagicTransit.Routes.New(context.TODO(), magic_transit.RouteNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Nexthop: cloudflare.F("203.0.113.1"), Prefix: cloudflare.F("192.0.2.0/24"), Priority: cloudflare.F(int64(0)), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", route.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "nexthop": "203.0.113.1", "prefix": "192.0.2.0/24", "priority": 0, "created_on": "2017-06-14T00:00:00Z", "description": "New route for new prefix 203.0.113.1", "modified_on": "2017-06-14T05:20:00Z", "scope": { "colo_names": [ "den01" ], "colo_regions": [ "APAC" ] }, "weight": 0 }, "success": true } ``` ## Update Route `client.MagicTransit.Routes.Update(ctx, routeID, params) (*RouteUpdateResponse, error)` **put** `/accounts/{account_id}/magic/routes/{route_id}` Update a specific Magic static route. Use `?validate_only=true` as an optional query parameter to run validation only without persisting changes. ### Parameters - `routeID string` Identifier - `params RouteUpdateParams` - `AccountID param.Field[string]` Path param: Identifier - `Nexthop param.Field[string]` Body param: The next-hop IP Address for the static route. - `Prefix param.Field[string]` Body param: IP Prefix in Classless Inter-Domain Routing format. - `Priority param.Field[int64]` Body param: Priority of the static route. - `Description param.Field[string]` Body param: An optional human provided description of the static route. - `Scope param.Field[Scope]` Body param: Used only for ECMP routes. - `Weight param.Field[int64]` Body param: Optional weight of the ECMP scope - if provided. ### Returns - `type RouteUpdateResponse struct{…}` - `Modified bool` - `ModifiedRoute RouteUpdateResponseModifiedRoute` - `ID string` Identifier - `Nexthop string` The next-hop IP Address for the static route. - `Prefix string` IP Prefix in Classless Inter-Domain Routing format. - `Priority int64` Priority of the static route. - `CreatedOn Time` When the route was created. - `Description string` An optional human provided description of the static route. - `ModifiedOn Time` When the route was last modified. - `Scope Scope` Used only for ECMP routes. - `ColoNames []string` List of colo names for the ECMP scope. - `ColoRegions []string` List of colo regions for the ECMP scope. - `Weight int64` Optional weight of the ECMP scope - if provided. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) route, err := client.MagicTransit.Routes.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.RouteUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Nexthop: cloudflare.F("203.0.113.1"), Prefix: cloudflare.F("192.0.2.0/24"), Priority: cloudflare.F(int64(0)), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", route.Modified) } ``` #### 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": { "modified": true, "modified_route": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "nexthop": "203.0.113.1", "prefix": "192.0.2.0/24", "priority": 0, "created_on": "2017-06-14T00:00:00Z", "description": "New route for new prefix 203.0.113.1", "modified_on": "2017-06-14T05:20:00Z", "scope": { "colo_names": [ "den01" ], "colo_regions": [ "APAC" ] }, "weight": 0 } }, "success": true } ``` ## Delete Route `client.MagicTransit.Routes.Delete(ctx, routeID, body) (*RouteDeleteResponse, error)` **delete** `/accounts/{account_id}/magic/routes/{route_id}` Disable and remove a specific Magic static route. ### Parameters - `routeID string` Identifier - `body RouteDeleteParams` - `AccountID param.Field[string]` Identifier ### Returns - `type RouteDeleteResponse struct{…}` - `Deleted bool` - `DeletedRoute RouteDeleteResponseDeletedRoute` - `ID string` Identifier - `Nexthop string` The next-hop IP Address for the static route. - `Prefix string` IP Prefix in Classless Inter-Domain Routing format. - `Priority int64` Priority of the static route. - `CreatedOn Time` When the route was created. - `Description string` An optional human provided description of the static route. - `ModifiedOn Time` When the route was last modified. - `Scope Scope` Used only for ECMP routes. - `ColoNames []string` List of colo names for the ECMP scope. - `ColoRegions []string` List of colo regions for the ECMP scope. - `Weight int64` Optional weight of the ECMP scope - if provided. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) route, err := client.MagicTransit.Routes.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.RouteDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", route.Deleted) } ``` #### 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": { "deleted": true, "deleted_route": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "nexthop": "203.0.113.1", "prefix": "192.0.2.0/24", "priority": 0, "created_on": "2017-06-14T00:00:00Z", "description": "New route for new prefix 203.0.113.1", "modified_on": "2017-06-14T05:20:00Z", "scope": { "colo_names": [ "den01" ], "colo_regions": [ "APAC" ] }, "weight": 0 } }, "success": true } ``` ## Update Many Routes `client.MagicTransit.Routes.BulkUpdate(ctx, params) (*RouteBulkUpdateResponse, error)` **put** `/accounts/{account_id}/magic/routes` Update multiple Magic static routes. Use `?validate_only=true` as an optional query parameter to run validation only without persisting changes. Only fields for a route that need to be changed need be provided. ### Parameters - `params RouteBulkUpdateParams` - `AccountID param.Field[string]` Path param: Identifier - `Routes param.Field[[]RouteBulkUpdateParamsRoute]` Body param - `ID string` Identifier - `Nexthop string` The next-hop IP Address for the static route. - `Prefix string` IP Prefix in Classless Inter-Domain Routing format. - `Priority int64` Priority of the static route. - `Description string` An optional human provided description of the static route. - `Scope Scope` Used only for ECMP routes. - `ColoNames []string` List of colo names for the ECMP scope. - `ColoRegions []string` List of colo regions for the ECMP scope. - `Weight int64` Optional weight of the ECMP scope - if provided. ### Returns - `type RouteBulkUpdateResponse struct{…}` - `Modified bool` - `ModifiedRoutes []RouteBulkUpdateResponseModifiedRoute` - `ID string` Identifier - `Nexthop string` The next-hop IP Address for the static route. - `Prefix string` IP Prefix in Classless Inter-Domain Routing format. - `Priority int64` Priority of the static route. - `CreatedOn Time` When the route was created. - `Description string` An optional human provided description of the static route. - `ModifiedOn Time` When the route was last modified. - `Scope Scope` Used only for ECMP routes. - `ColoNames []string` List of colo names for the ECMP scope. - `ColoRegions []string` List of colo regions for the ECMP scope. - `Weight int64` Optional weight of the ECMP scope - if provided. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.MagicTransit.Routes.BulkUpdate(context.TODO(), magic_transit.RouteBulkUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Routes: cloudflare.F([]magic_transit.RouteBulkUpdateParamsRoute{magic_transit.RouteBulkUpdateParamsRoute{ ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Nexthop: cloudflare.F("203.0.113.1"), Prefix: cloudflare.F("192.0.2.0/24"), Priority: cloudflare.F(int64(0)), }}), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Modified) } ``` #### 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": { "modified": true, "modified_routes": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "nexthop": "203.0.113.1", "prefix": "192.0.2.0/24", "priority": 0, "created_on": "2017-06-14T00:00:00Z", "description": "New route for new prefix 203.0.113.1", "modified_on": "2017-06-14T05:20:00Z", "scope": { "colo_names": [ "den01" ], "colo_regions": [ "APAC" ] }, "weight": 0 } ] }, "success": true } ``` ## Delete Many Routes `client.MagicTransit.Routes.Empty(ctx, body) (*RouteEmptyResponse, error)` **delete** `/accounts/{account_id}/magic/routes` Delete multiple Magic static routes. ### Parameters - `body RouteEmptyParams` - `AccountID param.Field[string]` Identifier ### Returns - `type RouteEmptyResponse struct{…}` - `Deleted bool` - `DeletedRoutes []RouteEmptyResponseDeletedRoute` - `ID string` Identifier - `Nexthop string` The next-hop IP Address for the static route. - `Prefix string` IP Prefix in Classless Inter-Domain Routing format. - `Priority int64` Priority of the static route. - `CreatedOn Time` When the route was created. - `Description string` An optional human provided description of the static route. - `ModifiedOn Time` When the route was last modified. - `Scope Scope` Used only for ECMP routes. - `ColoNames []string` List of colo names for the ECMP scope. - `ColoRegions []string` List of colo regions for the ECMP scope. - `Weight int64` Optional weight of the ECMP scope - if provided. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.MagicTransit.Routes.Empty(context.TODO(), magic_transit.RouteEmptyParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Deleted) } ``` #### 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": { "deleted": true, "deleted_routes": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "nexthop": "203.0.113.1", "prefix": "192.0.2.0/24", "priority": 0, "created_on": "2017-06-14T00:00:00Z", "description": "New route for new prefix 203.0.113.1", "modified_on": "2017-06-14T05:20:00Z", "scope": { "colo_names": [ "den01" ], "colo_regions": [ "APAC" ] }, "weight": 0 } ] }, "success": true } ``` ## Domain Types ### Scope - `type Scope struct{…}` Used only for ECMP routes. - `ColoNames []string` List of colo names for the ECMP scope. - `ColoRegions []string` List of colo regions for the ECMP scope. # Sites ## List Sites `client.MagicTransit.Sites.List(ctx, params) (*SinglePage[Site], error)` **get** `/accounts/{account_id}/magic/sites` Lists Sites associated with an account. Use connectorid query param to return sites where connectorid matches either site.ConnectorID or site.SecondaryConnectorID. ### Parameters - `params SiteListParams` - `AccountID param.Field[string]` Path param: Identifier - `Connectorid param.Field[string]` Query param: Identifier ### Returns - `type Site struct{…}` - `ID string` Identifier - `ConnectorID string` Magic Connector identifier tag. - `Description string` - `HaMode bool` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `Location SiteLocation` Location of site in latitude and longitude. - `Lat string` Latitude - `Lon string` Longitude - `Name string` The name of the site. - `SecondaryConnectorID string` Magic Connector identifier tag. Used when high availability mode is on. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.MagicTransit.Sites.List(context.TODO(), magic_transit.SiteListParams{ AccountID: 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": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "connector_id": "ac60d3d0435248289d446cedd870bcf4", "description": "description", "ha_mode": true, "location": { "lat": "37.6192", "lon": "122.3816" }, "name": "site_1", "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482" } ], "success": true } ``` ## Site Details `client.MagicTransit.Sites.Get(ctx, siteID, params) (*Site, error)` **get** `/accounts/{account_id}/magic/sites/{site_id}` Get a specific Site. ### Parameters - `siteID string` Identifier - `params SiteGetParams` - `AccountID param.Field[string]` Path param: Identifier - `XMagicNewHcTarget param.Field[bool]` Header param: If true, the health check target in the response body will be presented using the new object format. Defaults to false. ### Returns - `type Site struct{…}` - `ID string` Identifier - `ConnectorID string` Magic Connector identifier tag. - `Description string` - `HaMode bool` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `Location SiteLocation` Location of site in latitude and longitude. - `Lat string` Latitude - `Lon string` Longitude - `Name string` The name of the site. - `SecondaryConnectorID string` Magic Connector identifier tag. Used when high availability mode is on. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) site, err := client.MagicTransit.Sites.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", site.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "connector_id": "ac60d3d0435248289d446cedd870bcf4", "description": "description", "ha_mode": true, "location": { "lat": "37.6192", "lon": "122.3816" }, "name": "site_1", "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482" }, "success": true } ``` ## Create a new Site `client.MagicTransit.Sites.New(ctx, params) (*Site, error)` **post** `/accounts/{account_id}/magic/sites` Creates a new Site ### Parameters - `params SiteNewParams` - `AccountID param.Field[string]` Path param: Identifier - `Name param.Field[string]` Body param: The name of the site. - `ConnectorID param.Field[string]` Body param: Magic Connector identifier tag. - `Description param.Field[string]` Body param - `HaMode param.Field[bool]` Body param: Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `Location param.Field[SiteLocation]` Body param: Location of site in latitude and longitude. - `SecondaryConnectorID param.Field[string]` Body param: Magic Connector identifier tag. Used when high availability mode is on. ### Returns - `type Site struct{…}` - `ID string` Identifier - `ConnectorID string` Magic Connector identifier tag. - `Description string` - `HaMode bool` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `Location SiteLocation` Location of site in latitude and longitude. - `Lat string` Latitude - `Lon string` Longitude - `Name string` The name of the site. - `SecondaryConnectorID string` Magic Connector identifier tag. Used when high availability mode is on. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) site, err := client.MagicTransit.Sites.New(context.TODO(), magic_transit.SiteNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("site_1"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", site.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "connector_id": "ac60d3d0435248289d446cedd870bcf4", "description": "description", "ha_mode": true, "location": { "lat": "37.6192", "lon": "122.3816" }, "name": "site_1", "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482" }, "success": true } ``` ## Update Site `client.MagicTransit.Sites.Update(ctx, siteID, params) (*Site, error)` **put** `/accounts/{account_id}/magic/sites/{site_id}` Update a specific Site. ### Parameters - `siteID string` Identifier - `params SiteUpdateParams` - `AccountID param.Field[string]` Path param: Identifier - `ConnectorID param.Field[string]` Body param: Magic Connector identifier tag. - `Description param.Field[string]` Body param - `Location param.Field[SiteLocation]` Body param: Location of site in latitude and longitude. - `Name param.Field[string]` Body param: The name of the site. - `SecondaryConnectorID param.Field[string]` Body param: Magic Connector identifier tag. Used when high availability mode is on. ### Returns - `type Site struct{…}` - `ID string` Identifier - `ConnectorID string` Magic Connector identifier tag. - `Description string` - `HaMode bool` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `Location SiteLocation` Location of site in latitude and longitude. - `Lat string` Latitude - `Lon string` Longitude - `Name string` The name of the site. - `SecondaryConnectorID string` Magic Connector identifier tag. Used when high availability mode is on. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) site, err := client.MagicTransit.Sites.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", site.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "connector_id": "ac60d3d0435248289d446cedd870bcf4", "description": "description", "ha_mode": true, "location": { "lat": "37.6192", "lon": "122.3816" }, "name": "site_1", "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482" }, "success": true } ``` ## Patch Site `client.MagicTransit.Sites.Edit(ctx, siteID, params) (*Site, error)` **patch** `/accounts/{account_id}/magic/sites/{site_id}` Patch a specific Site. ### Parameters - `siteID string` Identifier - `params SiteEditParams` - `AccountID param.Field[string]` Path param: Identifier - `ConnectorID param.Field[string]` Body param: Magic Connector identifier tag. - `Description param.Field[string]` Body param - `Location param.Field[SiteLocation]` Body param: Location of site in latitude and longitude. - `Name param.Field[string]` Body param: The name of the site. - `SecondaryConnectorID param.Field[string]` Body param: Magic Connector identifier tag. Used when high availability mode is on. ### Returns - `type Site struct{…}` - `ID string` Identifier - `ConnectorID string` Magic Connector identifier tag. - `Description string` - `HaMode bool` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `Location SiteLocation` Location of site in latitude and longitude. - `Lat string` Latitude - `Lon string` Longitude - `Name string` The name of the site. - `SecondaryConnectorID string` Magic Connector identifier tag. Used when high availability mode is on. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) site, err := client.MagicTransit.Sites.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", site.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "connector_id": "ac60d3d0435248289d446cedd870bcf4", "description": "description", "ha_mode": true, "location": { "lat": "37.6192", "lon": "122.3816" }, "name": "site_1", "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482" }, "success": true } ``` ## Delete Site `client.MagicTransit.Sites.Delete(ctx, siteID, body) (*Site, error)` **delete** `/accounts/{account_id}/magic/sites/{site_id}` Remove a specific Site. ### Parameters - `siteID string` Identifier - `body SiteDeleteParams` - `AccountID param.Field[string]` Identifier ### Returns - `type Site struct{…}` - `ID string` Identifier - `ConnectorID string` Magic Connector identifier tag. - `Description string` - `HaMode bool` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `Location SiteLocation` Location of site in latitude and longitude. - `Lat string` Latitude - `Lon string` Longitude - `Name string` The name of the site. - `SecondaryConnectorID string` Magic Connector identifier tag. Used when high availability mode is on. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) site, err := client.MagicTransit.Sites.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", site.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "connector_id": "ac60d3d0435248289d446cedd870bcf4", "description": "description", "ha_mode": true, "location": { "lat": "37.6192", "lon": "122.3816" }, "name": "site_1", "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482" }, "success": true } ``` ## Domain Types ### Site - `type Site struct{…}` - `ID string` Identifier - `ConnectorID string` Magic Connector identifier tag. - `Description string` - `HaMode bool` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `Location SiteLocation` Location of site in latitude and longitude. - `Lat string` Latitude - `Lon string` Longitude - `Name string` The name of the site. - `SecondaryConnectorID string` Magic Connector identifier tag. Used when high availability mode is on. ### Site Location - `type SiteLocation struct{…}` Location of site in latitude and longitude. - `Lat string` Latitude - `Lon string` Longitude # App Configuration # ACLs ## List Site ACLs `client.MagicTransit.Sites.ACLs.List(ctx, siteID, query) (*SinglePage[ACL], error)` **get** `/accounts/{account_id}/magic/sites/{site_id}/acls` Lists Site ACLs associated with an account. ### Parameters - `siteID string` Identifier - `query SiteACLListParams` - `AccountID param.Field[string]` Identifier ### Returns - `type ACL struct{…}` Bidirectional ACL policy for network traffic within a site. - `ID string` Identifier - `Description string` Description for the ACL. - `ForwardLocally bool` The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false. - `LAN1 ACLConfiguration` - `LANID string` The identifier for the LAN you want to create an ACL policy with. - `LANName string` The name of the LAN based on the provided lan_id. - `PortRanges []string` Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed. - `Ports []int64` Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed. - `Subnets []Subnet` Array of subnet IPs within the LAN that will be included in the ACL. If no subnets are provided, communication on any subnets on this LAN are allowed. - `LAN2 ACLConfiguration` - `Name string` The name of the ACL. - `Protocols []AllowedProtocol` - `const AllowedProtocolTCP AllowedProtocol = "tcp"` - `const AllowedProtocolUdp AllowedProtocol = "udp"` - `const AllowedProtocolIcmp AllowedProtocol = "icmp"` - `Unidirectional bool` The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.MagicTransit.Sites.ACLs.List( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteACLListParams{ AccountID: 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": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "description": "Allows local traffic between PIN pads and cash register.", "forward_locally": true, "lan_1": { "lan_id": "lan_id", "lan_name": "lan_name", "port_ranges": [ "8080-9000" ], "ports": [ 1 ], "subnets": [ "192.0.2.1" ] }, "lan_2": { "lan_id": "lan_id", "lan_name": "lan_name", "port_ranges": [ "8080-9000" ], "ports": [ 1 ], "subnets": [ "192.0.2.1" ] }, "name": "PIN Pad - Cash Register", "protocols": [ "tcp" ], "unidirectional": true } ], "success": true } ``` ## Site ACL Details `client.MagicTransit.Sites.ACLs.Get(ctx, siteID, aclID, query) (*ACL, error)` **get** `/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_id}` Get a specific Site ACL. ### Parameters - `siteID string` Identifier - `aclID string` Identifier - `query SiteACLGetParams` - `AccountID param.Field[string]` Identifier ### Returns - `type ACL struct{…}` Bidirectional ACL policy for network traffic within a site. - `ID string` Identifier - `Description string` Description for the ACL. - `ForwardLocally bool` The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false. - `LAN1 ACLConfiguration` - `LANID string` The identifier for the LAN you want to create an ACL policy with. - `LANName string` The name of the LAN based on the provided lan_id. - `PortRanges []string` Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed. - `Ports []int64` Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed. - `Subnets []Subnet` Array of subnet IPs within the LAN that will be included in the ACL. If no subnets are provided, communication on any subnets on this LAN are allowed. - `LAN2 ACLConfiguration` - `Name string` The name of the ACL. - `Protocols []AllowedProtocol` - `const AllowedProtocolTCP AllowedProtocol = "tcp"` - `const AllowedProtocolUdp AllowedProtocol = "udp"` - `const AllowedProtocolIcmp AllowedProtocol = "icmp"` - `Unidirectional bool` The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) acl, err := client.MagicTransit.Sites.ACLs.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteACLGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", acl.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "description": "Allows local traffic between PIN pads and cash register.", "forward_locally": true, "lan_1": { "lan_id": "lan_id", "lan_name": "lan_name", "port_ranges": [ "8080-9000" ], "ports": [ 1 ], "subnets": [ "192.0.2.1" ] }, "lan_2": { "lan_id": "lan_id", "lan_name": "lan_name", "port_ranges": [ "8080-9000" ], "ports": [ 1 ], "subnets": [ "192.0.2.1" ] }, "name": "PIN Pad - Cash Register", "protocols": [ "tcp" ], "unidirectional": true }, "success": true } ``` ## Create a new Site ACL `client.MagicTransit.Sites.ACLs.New(ctx, siteID, params) (*ACL, error)` **post** `/accounts/{account_id}/magic/sites/{site_id}/acls` Creates a new Site ACL. ### Parameters - `siteID string` Identifier - `params SiteACLNewParams` - `AccountID param.Field[string]` Path param: Identifier - `LAN1 param.Field[ACLConfiguration]` Body param - `LAN2 param.Field[ACLConfiguration]` Body param - `Name param.Field[string]` Body param: The name of the ACL. - `Description param.Field[string]` Body param: Description for the ACL. - `ForwardLocally param.Field[bool]` Body param: The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false. - `Protocols param.Field[[]AllowedProtocol]` Body param - `const AllowedProtocolTCP AllowedProtocol = "tcp"` - `const AllowedProtocolUdp AllowedProtocol = "udp"` - `const AllowedProtocolIcmp AllowedProtocol = "icmp"` - `Unidirectional param.Field[bool]` Body param: The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false. ### Returns - `type ACL struct{…}` Bidirectional ACL policy for network traffic within a site. - `ID string` Identifier - `Description string` Description for the ACL. - `ForwardLocally bool` The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false. - `LAN1 ACLConfiguration` - `LANID string` The identifier for the LAN you want to create an ACL policy with. - `LANName string` The name of the LAN based on the provided lan_id. - `PortRanges []string` Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed. - `Ports []int64` Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed. - `Subnets []Subnet` Array of subnet IPs within the LAN that will be included in the ACL. If no subnets are provided, communication on any subnets on this LAN are allowed. - `LAN2 ACLConfiguration` - `Name string` The name of the ACL. - `Protocols []AllowedProtocol` - `const AllowedProtocolTCP AllowedProtocol = "tcp"` - `const AllowedProtocolUdp AllowedProtocol = "udp"` - `const AllowedProtocolIcmp AllowedProtocol = "icmp"` - `Unidirectional bool` The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) acl, err := client.MagicTransit.Sites.ACLs.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteACLNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), LAN1: cloudflare.F(magic_transit.ACLConfigurationParam{ LANID: cloudflare.F("lan_id"), }), LAN2: cloudflare.F(magic_transit.ACLConfigurationParam{ LANID: cloudflare.F("lan_id"), }), Name: cloudflare.F("PIN Pad - Cash Register"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", acl.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "description": "Allows local traffic between PIN pads and cash register.", "forward_locally": true, "lan_1": { "lan_id": "lan_id", "lan_name": "lan_name", "port_ranges": [ "8080-9000" ], "ports": [ 1 ], "subnets": [ "192.0.2.1" ] }, "lan_2": { "lan_id": "lan_id", "lan_name": "lan_name", "port_ranges": [ "8080-9000" ], "ports": [ 1 ], "subnets": [ "192.0.2.1" ] }, "name": "PIN Pad - Cash Register", "protocols": [ "tcp" ], "unidirectional": true }, "success": true } ``` ## Update Site ACL `client.MagicTransit.Sites.ACLs.Update(ctx, siteID, aclID, params) (*ACL, error)` **put** `/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_id}` Update a specific Site ACL. ### Parameters - `siteID string` Identifier - `aclID string` Identifier - `params SiteACLUpdateParams` - `AccountID param.Field[string]` Path param: Identifier - `Description param.Field[string]` Body param: Description for the ACL. - `ForwardLocally param.Field[bool]` Body param: The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false. - `LAN1 param.Field[ACLConfiguration]` Body param - `LAN2 param.Field[ACLConfiguration]` Body param - `Name param.Field[string]` Body param: The name of the ACL. - `Protocols param.Field[[]AllowedProtocol]` Body param - `const AllowedProtocolTCP AllowedProtocol = "tcp"` - `const AllowedProtocolUdp AllowedProtocol = "udp"` - `const AllowedProtocolIcmp AllowedProtocol = "icmp"` - `Unidirectional param.Field[bool]` Body param: The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false. ### Returns - `type ACL struct{…}` Bidirectional ACL policy for network traffic within a site. - `ID string` Identifier - `Description string` Description for the ACL. - `ForwardLocally bool` The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false. - `LAN1 ACLConfiguration` - `LANID string` The identifier for the LAN you want to create an ACL policy with. - `LANName string` The name of the LAN based on the provided lan_id. - `PortRanges []string` Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed. - `Ports []int64` Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed. - `Subnets []Subnet` Array of subnet IPs within the LAN that will be included in the ACL. If no subnets are provided, communication on any subnets on this LAN are allowed. - `LAN2 ACLConfiguration` - `Name string` The name of the ACL. - `Protocols []AllowedProtocol` - `const AllowedProtocolTCP AllowedProtocol = "tcp"` - `const AllowedProtocolUdp AllowedProtocol = "udp"` - `const AllowedProtocolIcmp AllowedProtocol = "icmp"` - `Unidirectional bool` The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) acl, err := client.MagicTransit.Sites.ACLs.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteACLUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", acl.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "description": "Allows local traffic between PIN pads and cash register.", "forward_locally": true, "lan_1": { "lan_id": "lan_id", "lan_name": "lan_name", "port_ranges": [ "8080-9000" ], "ports": [ 1 ], "subnets": [ "192.0.2.1" ] }, "lan_2": { "lan_id": "lan_id", "lan_name": "lan_name", "port_ranges": [ "8080-9000" ], "ports": [ 1 ], "subnets": [ "192.0.2.1" ] }, "name": "PIN Pad - Cash Register", "protocols": [ "tcp" ], "unidirectional": true }, "success": true } ``` ## Patch Site ACL `client.MagicTransit.Sites.ACLs.Edit(ctx, siteID, aclID, params) (*ACL, error)` **patch** `/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_id}` Patch a specific Site ACL. ### Parameters - `siteID string` Identifier - `aclID string` Identifier - `params SiteACLEditParams` - `AccountID param.Field[string]` Path param: Identifier - `Description param.Field[string]` Body param: Description for the ACL. - `ForwardLocally param.Field[bool]` Body param: The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false. - `LAN1 param.Field[ACLConfiguration]` Body param - `LAN2 param.Field[ACLConfiguration]` Body param - `Name param.Field[string]` Body param: The name of the ACL. - `Protocols param.Field[[]AllowedProtocol]` Body param - `const AllowedProtocolTCP AllowedProtocol = "tcp"` - `const AllowedProtocolUdp AllowedProtocol = "udp"` - `const AllowedProtocolIcmp AllowedProtocol = "icmp"` - `Unidirectional param.Field[bool]` Body param: The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false. ### Returns - `type ACL struct{…}` Bidirectional ACL policy for network traffic within a site. - `ID string` Identifier - `Description string` Description for the ACL. - `ForwardLocally bool` The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false. - `LAN1 ACLConfiguration` - `LANID string` The identifier for the LAN you want to create an ACL policy with. - `LANName string` The name of the LAN based on the provided lan_id. - `PortRanges []string` Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed. - `Ports []int64` Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed. - `Subnets []Subnet` Array of subnet IPs within the LAN that will be included in the ACL. If no subnets are provided, communication on any subnets on this LAN are allowed. - `LAN2 ACLConfiguration` - `Name string` The name of the ACL. - `Protocols []AllowedProtocol` - `const AllowedProtocolTCP AllowedProtocol = "tcp"` - `const AllowedProtocolUdp AllowedProtocol = "udp"` - `const AllowedProtocolIcmp AllowedProtocol = "icmp"` - `Unidirectional bool` The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) acl, err := client.MagicTransit.Sites.ACLs.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteACLEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", acl.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "description": "Allows local traffic between PIN pads and cash register.", "forward_locally": true, "lan_1": { "lan_id": "lan_id", "lan_name": "lan_name", "port_ranges": [ "8080-9000" ], "ports": [ 1 ], "subnets": [ "192.0.2.1" ] }, "lan_2": { "lan_id": "lan_id", "lan_name": "lan_name", "port_ranges": [ "8080-9000" ], "ports": [ 1 ], "subnets": [ "192.0.2.1" ] }, "name": "PIN Pad - Cash Register", "protocols": [ "tcp" ], "unidirectional": true }, "success": true } ``` ## Delete Site ACL `client.MagicTransit.Sites.ACLs.Delete(ctx, siteID, aclID, body) (*ACL, error)` **delete** `/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_id}` Remove a specific Site ACL. ### Parameters - `siteID string` Identifier - `aclID string` Identifier - `body SiteACLDeleteParams` - `AccountID param.Field[string]` Identifier ### Returns - `type ACL struct{…}` Bidirectional ACL policy for network traffic within a site. - `ID string` Identifier - `Description string` Description for the ACL. - `ForwardLocally bool` The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false. - `LAN1 ACLConfiguration` - `LANID string` The identifier for the LAN you want to create an ACL policy with. - `LANName string` The name of the LAN based on the provided lan_id. - `PortRanges []string` Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed. - `Ports []int64` Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed. - `Subnets []Subnet` Array of subnet IPs within the LAN that will be included in the ACL. If no subnets are provided, communication on any subnets on this LAN are allowed. - `LAN2 ACLConfiguration` - `Name string` The name of the ACL. - `Protocols []AllowedProtocol` - `const AllowedProtocolTCP AllowedProtocol = "tcp"` - `const AllowedProtocolUdp AllowedProtocol = "udp"` - `const AllowedProtocolIcmp AllowedProtocol = "icmp"` - `Unidirectional bool` The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) acl, err := client.MagicTransit.Sites.ACLs.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteACLDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", acl.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "description": "Allows local traffic between PIN pads and cash register.", "forward_locally": true, "lan_1": { "lan_id": "lan_id", "lan_name": "lan_name", "port_ranges": [ "8080-9000" ], "ports": [ 1 ], "subnets": [ "192.0.2.1" ] }, "lan_2": { "lan_id": "lan_id", "lan_name": "lan_name", "port_ranges": [ "8080-9000" ], "ports": [ 1 ], "subnets": [ "192.0.2.1" ] }, "name": "PIN Pad - Cash Register", "protocols": [ "tcp" ], "unidirectional": true }, "success": true } ``` ## Domain Types ### ACL - `type ACL struct{…}` Bidirectional ACL policy for network traffic within a site. - `ID string` Identifier - `Description string` Description for the ACL. - `ForwardLocally bool` The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false. - `LAN1 ACLConfiguration` - `LANID string` The identifier for the LAN you want to create an ACL policy with. - `LANName string` The name of the LAN based on the provided lan_id. - `PortRanges []string` Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed. - `Ports []int64` Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed. - `Subnets []Subnet` Array of subnet IPs within the LAN that will be included in the ACL. If no subnets are provided, communication on any subnets on this LAN are allowed. - `LAN2 ACLConfiguration` - `Name string` The name of the ACL. - `Protocols []AllowedProtocol` - `const AllowedProtocolTCP AllowedProtocol = "tcp"` - `const AllowedProtocolUdp AllowedProtocol = "udp"` - `const AllowedProtocolIcmp AllowedProtocol = "icmp"` - `Unidirectional bool` The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false. ### ACL Configuration - `type ACLConfiguration struct{…}` - `LANID string` The identifier for the LAN you want to create an ACL policy with. - `LANName string` The name of the LAN based on the provided lan_id. - `PortRanges []string` Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed. - `Ports []int64` Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed. - `Subnets []Subnet` Array of subnet IPs within the LAN that will be included in the ACL. If no subnets are provided, communication on any subnets on this LAN are allowed. ### Allowed Protocol - `type AllowedProtocol string` Array of allowed communication protocols between configured LANs. If no protocols are provided, all protocols are allowed. - `const AllowedProtocolTCP AllowedProtocol = "tcp"` - `const AllowedProtocolUdp AllowedProtocol = "udp"` - `const AllowedProtocolIcmp AllowedProtocol = "icmp"` ### Subnet - `type Subnet string` A valid IPv4 address. # LANs ## List Site LANs `client.MagicTransit.Sites.LANs.List(ctx, siteID, query) (*SinglePage[LAN], error)` **get** `/accounts/{account_id}/magic/sites/{site_id}/lans` Lists Site LANs associated with an account. ### Parameters - `siteID string` Identifier - `query SiteLANListParams` - `AccountID param.Field[string]` Identifier ### Returns - `type LAN struct{…}` - `ID string` Identifier - `BondID int64` - `HaLink bool` mark true to use this LAN for HA probing. only works for site with HA turned on. only one LAN can be set as the ha_link. - `IsBreakout bool` mark true to use this LAN for source-based breakout traffic - `IsPrioritized bool` mark true to use this LAN for source-based prioritized traffic - `Name string` - `Nat Nat` - `StaticPrefix string` A valid CIDR notation representing an IP range. - `Physport int64` - `RoutedSubnets []RoutedSubnet` - `NextHop string` A valid IPv4 address. - `Prefix string` A valid CIDR notation representing an IP range. - `Nat Nat` - `SiteID string` Identifier - `StaticAddressing LANStaticAddressing` If the site is not configured in high availability mode, this configuration is optional (if omitted, use DHCP). However, if in high availability mode, static_address is required along with secondary and virtual address. - `Address string` A valid CIDR notation representing an IP range. - `DHCPRelay DHCPRelay` - `ServerAddresses []string` List of DHCP server IPs. - `DHCPServer DHCPServer` - `DHCPPoolEnd string` A valid IPv4 address. - `DHCPPoolStart string` A valid IPv4 address. - `DNSServer string` A valid IPv4 address. - `DNSServers []string` - `Reservations map[string, string]` Mapping of MAC addresses to IP addresses - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VirtualAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.MagicTransit.Sites.LANs.List( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteLANListParams{ AccountID: 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": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "bond_id": 2, "ha_link": true, "is_breakout": true, "is_prioritized": true, "name": "name", "nat": { "static_prefix": "192.0.2.0/24" }, "physport": 1, "routed_subnets": [ { "next_hop": "192.0.2.1", "prefix": "192.0.2.0/24", "nat": { "static_prefix": "192.0.2.0/24" } } ], "site_id": "023e105f4ecef8ad9ca31a8372d0c353", "static_addressing": { "address": "192.0.2.0/24", "dhcp_relay": { "server_addresses": [ "192.0.2.1" ] }, "dhcp_server": { "dhcp_pool_end": "192.0.2.1", "dhcp_pool_start": "192.0.2.1", "dns_server": "192.0.2.1", "dns_servers": [ "192.0.2.1" ], "reservations": { "00:11:22:33:44:55": "192.0.2.100", "AA:BB:CC:DD:EE:FF": "192.168.1.101" } }, "secondary_address": "192.0.2.0/24", "virtual_address": "192.0.2.0/24" }, "vlan_tag": 42 } ], "success": true } ``` ## Site LAN Details `client.MagicTransit.Sites.LANs.Get(ctx, siteID, lanID, query) (*LAN, error)` **get** `/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}` Get a specific Site LAN. ### Parameters - `siteID string` Identifier - `lanID string` Identifier - `query SiteLANGetParams` - `AccountID param.Field[string]` Identifier ### Returns - `type LAN struct{…}` - `ID string` Identifier - `BondID int64` - `HaLink bool` mark true to use this LAN for HA probing. only works for site with HA turned on. only one LAN can be set as the ha_link. - `IsBreakout bool` mark true to use this LAN for source-based breakout traffic - `IsPrioritized bool` mark true to use this LAN for source-based prioritized traffic - `Name string` - `Nat Nat` - `StaticPrefix string` A valid CIDR notation representing an IP range. - `Physport int64` - `RoutedSubnets []RoutedSubnet` - `NextHop string` A valid IPv4 address. - `Prefix string` A valid CIDR notation representing an IP range. - `Nat Nat` - `SiteID string` Identifier - `StaticAddressing LANStaticAddressing` If the site is not configured in high availability mode, this configuration is optional (if omitted, use DHCP). However, if in high availability mode, static_address is required along with secondary and virtual address. - `Address string` A valid CIDR notation representing an IP range. - `DHCPRelay DHCPRelay` - `ServerAddresses []string` List of DHCP server IPs. - `DHCPServer DHCPServer` - `DHCPPoolEnd string` A valid IPv4 address. - `DHCPPoolStart string` A valid IPv4 address. - `DNSServer string` A valid IPv4 address. - `DNSServers []string` - `Reservations map[string, string]` Mapping of MAC addresses to IP addresses - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VirtualAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) lan, err := client.MagicTransit.Sites.LANs.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteLANGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", lan.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "bond_id": 2, "ha_link": true, "is_breakout": true, "is_prioritized": true, "name": "name", "nat": { "static_prefix": "192.0.2.0/24" }, "physport": 1, "routed_subnets": [ { "next_hop": "192.0.2.1", "prefix": "192.0.2.0/24", "nat": { "static_prefix": "192.0.2.0/24" } } ], "site_id": "023e105f4ecef8ad9ca31a8372d0c353", "static_addressing": { "address": "192.0.2.0/24", "dhcp_relay": { "server_addresses": [ "192.0.2.1" ] }, "dhcp_server": { "dhcp_pool_end": "192.0.2.1", "dhcp_pool_start": "192.0.2.1", "dns_server": "192.0.2.1", "dns_servers": [ "192.0.2.1" ], "reservations": { "00:11:22:33:44:55": "192.0.2.100", "AA:BB:CC:DD:EE:FF": "192.168.1.101" } }, "secondary_address": "192.0.2.0/24", "virtual_address": "192.0.2.0/24" }, "vlan_tag": 42 }, "success": true } ``` ## Create a new Site LAN `client.MagicTransit.Sites.LANs.New(ctx, siteID, params) (*SinglePage[LAN], error)` **post** `/accounts/{account_id}/magic/sites/{site_id}/lans` Creates a new Site LAN. If the site is in high availability mode, static_addressing is required along with secondary and virtual address. ### Parameters - `siteID string` Identifier - `params SiteLANNewParams` - `AccountID param.Field[string]` Path param: Identifier - `BondID param.Field[int64]` Body param - `HaLink param.Field[bool]` Body param: mark true to use this LAN for HA probing. only works for site with HA turned on. only one LAN can be set as the ha_link. - `IsBreakout param.Field[bool]` Body param: mark true to use this LAN for source-based breakout traffic - `IsPrioritized param.Field[bool]` Body param: mark true to use this LAN for source-based prioritized traffic - `Name param.Field[string]` Body param - `Nat param.Field[Nat]` Body param - `Physport param.Field[int64]` Body param - `RoutedSubnets param.Field[[]RoutedSubnet]` Body param - `NextHop string` A valid IPv4 address. - `Prefix string` A valid CIDR notation representing an IP range. - `Nat Nat` - `StaticPrefix string` A valid CIDR notation representing an IP range. - `StaticAddressing param.Field[LANStaticAddressing]` Body param: If the site is not configured in high availability mode, this configuration is optional (if omitted, use DHCP). However, if in high availability mode, static_address is required along with secondary and virtual address. - `VlanTag param.Field[int64]` Body param: VLAN ID. Use zero for untagged. ### Returns - `type LAN struct{…}` - `ID string` Identifier - `BondID int64` - `HaLink bool` mark true to use this LAN for HA probing. only works for site with HA turned on. only one LAN can be set as the ha_link. - `IsBreakout bool` mark true to use this LAN for source-based breakout traffic - `IsPrioritized bool` mark true to use this LAN for source-based prioritized traffic - `Name string` - `Nat Nat` - `StaticPrefix string` A valid CIDR notation representing an IP range. - `Physport int64` - `RoutedSubnets []RoutedSubnet` - `NextHop string` A valid IPv4 address. - `Prefix string` A valid CIDR notation representing an IP range. - `Nat Nat` - `SiteID string` Identifier - `StaticAddressing LANStaticAddressing` If the site is not configured in high availability mode, this configuration is optional (if omitted, use DHCP). However, if in high availability mode, static_address is required along with secondary and virtual address. - `Address string` A valid CIDR notation representing an IP range. - `DHCPRelay DHCPRelay` - `ServerAddresses []string` List of DHCP server IPs. - `DHCPServer DHCPServer` - `DHCPPoolEnd string` A valid IPv4 address. - `DHCPPoolStart string` A valid IPv4 address. - `DNSServer string` A valid IPv4 address. - `DNSServers []string` - `Reservations map[string, string]` Mapping of MAC addresses to IP addresses - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VirtualAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.MagicTransit.Sites.LANs.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteLANNewParams{ AccountID: 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": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "bond_id": 2, "ha_link": true, "is_breakout": true, "is_prioritized": true, "name": "name", "nat": { "static_prefix": "192.0.2.0/24" }, "physport": 1, "routed_subnets": [ { "next_hop": "192.0.2.1", "prefix": "192.0.2.0/24", "nat": { "static_prefix": "192.0.2.0/24" } } ], "site_id": "023e105f4ecef8ad9ca31a8372d0c353", "static_addressing": { "address": "192.0.2.0/24", "dhcp_relay": { "server_addresses": [ "192.0.2.1" ] }, "dhcp_server": { "dhcp_pool_end": "192.0.2.1", "dhcp_pool_start": "192.0.2.1", "dns_server": "192.0.2.1", "dns_servers": [ "192.0.2.1" ], "reservations": { "00:11:22:33:44:55": "192.0.2.100", "AA:BB:CC:DD:EE:FF": "192.168.1.101" } }, "secondary_address": "192.0.2.0/24", "virtual_address": "192.0.2.0/24" }, "vlan_tag": 42 } ], "success": true } ``` ## Update Site LAN `client.MagicTransit.Sites.LANs.Update(ctx, siteID, lanID, params) (*LAN, error)` **put** `/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}` Update a specific Site LAN. ### Parameters - `siteID string` Identifier - `lanID string` Identifier - `params SiteLANUpdateParams` - `AccountID param.Field[string]` Path param: Identifier - `BondID param.Field[int64]` Body param - `IsBreakout param.Field[bool]` Body param: mark true to use this LAN for source-based breakout traffic - `IsPrioritized param.Field[bool]` Body param: mark true to use this LAN for source-based prioritized traffic - `Name param.Field[string]` Body param - `Nat param.Field[Nat]` Body param - `Physport param.Field[int64]` Body param - `RoutedSubnets param.Field[[]RoutedSubnet]` Body param - `NextHop string` A valid IPv4 address. - `Prefix string` A valid CIDR notation representing an IP range. - `Nat Nat` - `StaticPrefix string` A valid CIDR notation representing an IP range. - `StaticAddressing param.Field[LANStaticAddressing]` Body param: If the site is not configured in high availability mode, this configuration is optional (if omitted, use DHCP). However, if in high availability mode, static_address is required along with secondary and virtual address. - `VlanTag param.Field[int64]` Body param: VLAN ID. Use zero for untagged. ### Returns - `type LAN struct{…}` - `ID string` Identifier - `BondID int64` - `HaLink bool` mark true to use this LAN for HA probing. only works for site with HA turned on. only one LAN can be set as the ha_link. - `IsBreakout bool` mark true to use this LAN for source-based breakout traffic - `IsPrioritized bool` mark true to use this LAN for source-based prioritized traffic - `Name string` - `Nat Nat` - `StaticPrefix string` A valid CIDR notation representing an IP range. - `Physport int64` - `RoutedSubnets []RoutedSubnet` - `NextHop string` A valid IPv4 address. - `Prefix string` A valid CIDR notation representing an IP range. - `Nat Nat` - `SiteID string` Identifier - `StaticAddressing LANStaticAddressing` If the site is not configured in high availability mode, this configuration is optional (if omitted, use DHCP). However, if in high availability mode, static_address is required along with secondary and virtual address. - `Address string` A valid CIDR notation representing an IP range. - `DHCPRelay DHCPRelay` - `ServerAddresses []string` List of DHCP server IPs. - `DHCPServer DHCPServer` - `DHCPPoolEnd string` A valid IPv4 address. - `DHCPPoolStart string` A valid IPv4 address. - `DNSServer string` A valid IPv4 address. - `DNSServers []string` - `Reservations map[string, string]` Mapping of MAC addresses to IP addresses - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VirtualAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) lan, err := client.MagicTransit.Sites.LANs.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteLANUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", lan.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "bond_id": 2, "ha_link": true, "is_breakout": true, "is_prioritized": true, "name": "name", "nat": { "static_prefix": "192.0.2.0/24" }, "physport": 1, "routed_subnets": [ { "next_hop": "192.0.2.1", "prefix": "192.0.2.0/24", "nat": { "static_prefix": "192.0.2.0/24" } } ], "site_id": "023e105f4ecef8ad9ca31a8372d0c353", "static_addressing": { "address": "192.0.2.0/24", "dhcp_relay": { "server_addresses": [ "192.0.2.1" ] }, "dhcp_server": { "dhcp_pool_end": "192.0.2.1", "dhcp_pool_start": "192.0.2.1", "dns_server": "192.0.2.1", "dns_servers": [ "192.0.2.1" ], "reservations": { "00:11:22:33:44:55": "192.0.2.100", "AA:BB:CC:DD:EE:FF": "192.168.1.101" } }, "secondary_address": "192.0.2.0/24", "virtual_address": "192.0.2.0/24" }, "vlan_tag": 42 }, "success": true } ``` ## Patch Site LAN `client.MagicTransit.Sites.LANs.Edit(ctx, siteID, lanID, params) (*LAN, error)` **patch** `/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}` Patch a specific Site LAN. ### Parameters - `siteID string` Identifier - `lanID string` Identifier - `params SiteLANEditParams` - `AccountID param.Field[string]` Path param: Identifier - `BondID param.Field[int64]` Body param - `IsBreakout param.Field[bool]` Body param: mark true to use this LAN for source-based breakout traffic - `IsPrioritized param.Field[bool]` Body param: mark true to use this LAN for source-based prioritized traffic - `Name param.Field[string]` Body param - `Nat param.Field[Nat]` Body param - `Physport param.Field[int64]` Body param - `RoutedSubnets param.Field[[]RoutedSubnet]` Body param - `NextHop string` A valid IPv4 address. - `Prefix string` A valid CIDR notation representing an IP range. - `Nat Nat` - `StaticPrefix string` A valid CIDR notation representing an IP range. - `StaticAddressing param.Field[LANStaticAddressing]` Body param: If the site is not configured in high availability mode, this configuration is optional (if omitted, use DHCP). However, if in high availability mode, static_address is required along with secondary and virtual address. - `VlanTag param.Field[int64]` Body param: VLAN ID. Use zero for untagged. ### Returns - `type LAN struct{…}` - `ID string` Identifier - `BondID int64` - `HaLink bool` mark true to use this LAN for HA probing. only works for site with HA turned on. only one LAN can be set as the ha_link. - `IsBreakout bool` mark true to use this LAN for source-based breakout traffic - `IsPrioritized bool` mark true to use this LAN for source-based prioritized traffic - `Name string` - `Nat Nat` - `StaticPrefix string` A valid CIDR notation representing an IP range. - `Physport int64` - `RoutedSubnets []RoutedSubnet` - `NextHop string` A valid IPv4 address. - `Prefix string` A valid CIDR notation representing an IP range. - `Nat Nat` - `SiteID string` Identifier - `StaticAddressing LANStaticAddressing` If the site is not configured in high availability mode, this configuration is optional (if omitted, use DHCP). However, if in high availability mode, static_address is required along with secondary and virtual address. - `Address string` A valid CIDR notation representing an IP range. - `DHCPRelay DHCPRelay` - `ServerAddresses []string` List of DHCP server IPs. - `DHCPServer DHCPServer` - `DHCPPoolEnd string` A valid IPv4 address. - `DHCPPoolStart string` A valid IPv4 address. - `DNSServer string` A valid IPv4 address. - `DNSServers []string` - `Reservations map[string, string]` Mapping of MAC addresses to IP addresses - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VirtualAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) lan, err := client.MagicTransit.Sites.LANs.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteLANEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", lan.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "bond_id": 2, "ha_link": true, "is_breakout": true, "is_prioritized": true, "name": "name", "nat": { "static_prefix": "192.0.2.0/24" }, "physport": 1, "routed_subnets": [ { "next_hop": "192.0.2.1", "prefix": "192.0.2.0/24", "nat": { "static_prefix": "192.0.2.0/24" } } ], "site_id": "023e105f4ecef8ad9ca31a8372d0c353", "static_addressing": { "address": "192.0.2.0/24", "dhcp_relay": { "server_addresses": [ "192.0.2.1" ] }, "dhcp_server": { "dhcp_pool_end": "192.0.2.1", "dhcp_pool_start": "192.0.2.1", "dns_server": "192.0.2.1", "dns_servers": [ "192.0.2.1" ], "reservations": { "00:11:22:33:44:55": "192.0.2.100", "AA:BB:CC:DD:EE:FF": "192.168.1.101" } }, "secondary_address": "192.0.2.0/24", "virtual_address": "192.0.2.0/24" }, "vlan_tag": 42 }, "success": true } ``` ## Delete Site LAN `client.MagicTransit.Sites.LANs.Delete(ctx, siteID, lanID, body) (*LAN, error)` **delete** `/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}` Remove a specific Site LAN. ### Parameters - `siteID string` Identifier - `lanID string` Identifier - `body SiteLANDeleteParams` - `AccountID param.Field[string]` Identifier ### Returns - `type LAN struct{…}` - `ID string` Identifier - `BondID int64` - `HaLink bool` mark true to use this LAN for HA probing. only works for site with HA turned on. only one LAN can be set as the ha_link. - `IsBreakout bool` mark true to use this LAN for source-based breakout traffic - `IsPrioritized bool` mark true to use this LAN for source-based prioritized traffic - `Name string` - `Nat Nat` - `StaticPrefix string` A valid CIDR notation representing an IP range. - `Physport int64` - `RoutedSubnets []RoutedSubnet` - `NextHop string` A valid IPv4 address. - `Prefix string` A valid CIDR notation representing an IP range. - `Nat Nat` - `SiteID string` Identifier - `StaticAddressing LANStaticAddressing` If the site is not configured in high availability mode, this configuration is optional (if omitted, use DHCP). However, if in high availability mode, static_address is required along with secondary and virtual address. - `Address string` A valid CIDR notation representing an IP range. - `DHCPRelay DHCPRelay` - `ServerAddresses []string` List of DHCP server IPs. - `DHCPServer DHCPServer` - `DHCPPoolEnd string` A valid IPv4 address. - `DHCPPoolStart string` A valid IPv4 address. - `DNSServer string` A valid IPv4 address. - `DNSServers []string` - `Reservations map[string, string]` Mapping of MAC addresses to IP addresses - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VirtualAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) lan, err := client.MagicTransit.Sites.LANs.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteLANDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", lan.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "bond_id": 2, "ha_link": true, "is_breakout": true, "is_prioritized": true, "name": "name", "nat": { "static_prefix": "192.0.2.0/24" }, "physport": 1, "routed_subnets": [ { "next_hop": "192.0.2.1", "prefix": "192.0.2.0/24", "nat": { "static_prefix": "192.0.2.0/24" } } ], "site_id": "023e105f4ecef8ad9ca31a8372d0c353", "static_addressing": { "address": "192.0.2.0/24", "dhcp_relay": { "server_addresses": [ "192.0.2.1" ] }, "dhcp_server": { "dhcp_pool_end": "192.0.2.1", "dhcp_pool_start": "192.0.2.1", "dns_server": "192.0.2.1", "dns_servers": [ "192.0.2.1" ], "reservations": { "00:11:22:33:44:55": "192.0.2.100", "AA:BB:CC:DD:EE:FF": "192.168.1.101" } }, "secondary_address": "192.0.2.0/24", "virtual_address": "192.0.2.0/24" }, "vlan_tag": 42 }, "success": true } ``` ## Domain Types ### DHCP Relay - `type DHCPRelay struct{…}` - `ServerAddresses []string` List of DHCP server IPs. ### DHCP Server - `type DHCPServer struct{…}` - `DHCPPoolEnd string` A valid IPv4 address. - `DHCPPoolStart string` A valid IPv4 address. - `DNSServer string` A valid IPv4 address. - `DNSServers []string` - `Reservations map[string, string]` Mapping of MAC addresses to IP addresses ### LAN - `type LAN struct{…}` - `ID string` Identifier - `BondID int64` - `HaLink bool` mark true to use this LAN for HA probing. only works for site with HA turned on. only one LAN can be set as the ha_link. - `IsBreakout bool` mark true to use this LAN for source-based breakout traffic - `IsPrioritized bool` mark true to use this LAN for source-based prioritized traffic - `Name string` - `Nat Nat` - `StaticPrefix string` A valid CIDR notation representing an IP range. - `Physport int64` - `RoutedSubnets []RoutedSubnet` - `NextHop string` A valid IPv4 address. - `Prefix string` A valid CIDR notation representing an IP range. - `Nat Nat` - `SiteID string` Identifier - `StaticAddressing LANStaticAddressing` If the site is not configured in high availability mode, this configuration is optional (if omitted, use DHCP). However, if in high availability mode, static_address is required along with secondary and virtual address. - `Address string` A valid CIDR notation representing an IP range. - `DHCPRelay DHCPRelay` - `ServerAddresses []string` List of DHCP server IPs. - `DHCPServer DHCPServer` - `DHCPPoolEnd string` A valid IPv4 address. - `DHCPPoolStart string` A valid IPv4 address. - `DNSServer string` A valid IPv4 address. - `DNSServers []string` - `Reservations map[string, string]` Mapping of MAC addresses to IP addresses - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VirtualAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### LAN Static Addressing - `type LANStaticAddressing struct{…}` If the site is not configured in high availability mode, this configuration is optional (if omitted, use DHCP). However, if in high availability mode, static_address is required along with secondary and virtual address. - `Address string` A valid CIDR notation representing an IP range. - `DHCPRelay DHCPRelay` - `ServerAddresses []string` List of DHCP server IPs. - `DHCPServer DHCPServer` - `DHCPPoolEnd string` A valid IPv4 address. - `DHCPPoolStart string` A valid IPv4 address. - `DNSServer string` A valid IPv4 address. - `DNSServers []string` - `Reservations map[string, string]` Mapping of MAC addresses to IP addresses - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VirtualAddress string` A valid CIDR notation representing an IP range. ### Nat - `type Nat struct{…}` - `StaticPrefix string` A valid CIDR notation representing an IP range. ### Routed Subnet - `type RoutedSubnet struct{…}` - `NextHop string` A valid IPv4 address. - `Prefix string` A valid CIDR notation representing an IP range. - `Nat Nat` - `StaticPrefix string` A valid CIDR notation representing an IP range. # WANs ## List Site WANs `client.MagicTransit.Sites.WANs.List(ctx, siteID, query) (*SinglePage[WAN], error)` **get** `/accounts/{account_id}/magic/sites/{site_id}/wans` Lists Site WANs associated with an account. ### Parameters - `siteID string` Identifier - `query SiteWANListParams` - `AccountID param.Field[string]` Identifier ### Returns - `type WAN struct{…}` - `ID string` Identifier - `HealthCheckRate WANHealthCheckRate` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `const WANHealthCheckRateLow WANHealthCheckRate = "low"` - `const WANHealthCheckRateMid WANHealthCheckRate = "mid"` - `const WANHealthCheckRateHigh WANHealthCheckRate = "high"` - `Name string` - `Physport int64` - `Priority int64` Priority of WAN for traffic loadbalancing. - `SiteID string` Identifier - `StaticAddressing WANStaticAddressing` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `Address string` A valid CIDR notation representing an IP range. - `GatewayAddress string` A valid IPv4 address. - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.MagicTransit.Sites.WANs.List( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteWANListParams{ AccountID: 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": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "health_check_rate": "low", "name": "name", "physport": 1, "priority": 0, "site_id": "023e105f4ecef8ad9ca31a8372d0c353", "static_addressing": { "address": "192.0.2.0/24", "gateway_address": "192.0.2.1", "secondary_address": "192.0.2.0/24" }, "vlan_tag": 42 } ], "success": true } ``` ## Site WAN Details `client.MagicTransit.Sites.WANs.Get(ctx, siteID, wanID, query) (*WAN, error)` **get** `/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}` Get a specific Site WAN. ### Parameters - `siteID string` Identifier - `wanID string` Identifier - `query SiteWANGetParams` - `AccountID param.Field[string]` Identifier ### Returns - `type WAN struct{…}` - `ID string` Identifier - `HealthCheckRate WANHealthCheckRate` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `const WANHealthCheckRateLow WANHealthCheckRate = "low"` - `const WANHealthCheckRateMid WANHealthCheckRate = "mid"` - `const WANHealthCheckRateHigh WANHealthCheckRate = "high"` - `Name string` - `Physport int64` - `Priority int64` Priority of WAN for traffic loadbalancing. - `SiteID string` Identifier - `StaticAddressing WANStaticAddressing` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `Address string` A valid CIDR notation representing an IP range. - `GatewayAddress string` A valid IPv4 address. - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) wan, err := client.MagicTransit.Sites.WANs.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteWANGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", wan.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "health_check_rate": "low", "name": "name", "physport": 1, "priority": 0, "site_id": "023e105f4ecef8ad9ca31a8372d0c353", "static_addressing": { "address": "192.0.2.0/24", "gateway_address": "192.0.2.1", "secondary_address": "192.0.2.0/24" }, "vlan_tag": 42 }, "success": true } ``` ## Create a new Site WAN `client.MagicTransit.Sites.WANs.New(ctx, siteID, params) (*SinglePage[WAN], error)` **post** `/accounts/{account_id}/magic/sites/{site_id}/wans` Creates a new Site WAN. ### Parameters - `siteID string` Identifier - `params SiteWANNewParams` - `AccountID param.Field[string]` Path param: Identifier - `Physport param.Field[int64]` Body param - `Name param.Field[string]` Body param - `Priority param.Field[int64]` Body param - `StaticAddressing param.Field[WANStaticAddressing]` Body param: (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `VlanTag param.Field[int64]` Body param: VLAN ID. Use zero for untagged. ### Returns - `type WAN struct{…}` - `ID string` Identifier - `HealthCheckRate WANHealthCheckRate` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `const WANHealthCheckRateLow WANHealthCheckRate = "low"` - `const WANHealthCheckRateMid WANHealthCheckRate = "mid"` - `const WANHealthCheckRateHigh WANHealthCheckRate = "high"` - `Name string` - `Physport int64` - `Priority int64` Priority of WAN for traffic loadbalancing. - `SiteID string` Identifier - `StaticAddressing WANStaticAddressing` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `Address string` A valid CIDR notation representing an IP range. - `GatewayAddress string` A valid IPv4 address. - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.MagicTransit.Sites.WANs.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteWANNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Physport: cloudflare.F(int64(1)), }, ) 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": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "health_check_rate": "low", "name": "name", "physport": 1, "priority": 0, "site_id": "023e105f4ecef8ad9ca31a8372d0c353", "static_addressing": { "address": "192.0.2.0/24", "gateway_address": "192.0.2.1", "secondary_address": "192.0.2.0/24" }, "vlan_tag": 42 } ], "success": true } ``` ## Update Site WAN `client.MagicTransit.Sites.WANs.Update(ctx, siteID, wanID, params) (*WAN, error)` **put** `/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}` Update a specific Site WAN. ### Parameters - `siteID string` Identifier - `wanID string` Identifier - `params SiteWANUpdateParams` - `AccountID param.Field[string]` Path param: Identifier - `Name param.Field[string]` Body param - `Physport param.Field[int64]` Body param - `Priority param.Field[int64]` Body param - `StaticAddressing param.Field[WANStaticAddressing]` Body param: (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `VlanTag param.Field[int64]` Body param: VLAN ID. Use zero for untagged. ### Returns - `type WAN struct{…}` - `ID string` Identifier - `HealthCheckRate WANHealthCheckRate` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `const WANHealthCheckRateLow WANHealthCheckRate = "low"` - `const WANHealthCheckRateMid WANHealthCheckRate = "mid"` - `const WANHealthCheckRateHigh WANHealthCheckRate = "high"` - `Name string` - `Physport int64` - `Priority int64` Priority of WAN for traffic loadbalancing. - `SiteID string` Identifier - `StaticAddressing WANStaticAddressing` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `Address string` A valid CIDR notation representing an IP range. - `GatewayAddress string` A valid IPv4 address. - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) wan, err := client.MagicTransit.Sites.WANs.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteWANUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", wan.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "health_check_rate": "low", "name": "name", "physport": 1, "priority": 0, "site_id": "023e105f4ecef8ad9ca31a8372d0c353", "static_addressing": { "address": "192.0.2.0/24", "gateway_address": "192.0.2.1", "secondary_address": "192.0.2.0/24" }, "vlan_tag": 42 }, "success": true } ``` ## Patch Site WAN `client.MagicTransit.Sites.WANs.Edit(ctx, siteID, wanID, params) (*WAN, error)` **patch** `/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}` Patch a specific Site WAN. ### Parameters - `siteID string` Identifier - `wanID string` Identifier - `params SiteWANEditParams` - `AccountID param.Field[string]` Path param: Identifier - `Name param.Field[string]` Body param - `Physport param.Field[int64]` Body param - `Priority param.Field[int64]` Body param - `StaticAddressing param.Field[WANStaticAddressing]` Body param: (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `VlanTag param.Field[int64]` Body param: VLAN ID. Use zero for untagged. ### Returns - `type WAN struct{…}` - `ID string` Identifier - `HealthCheckRate WANHealthCheckRate` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `const WANHealthCheckRateLow WANHealthCheckRate = "low"` - `const WANHealthCheckRateMid WANHealthCheckRate = "mid"` - `const WANHealthCheckRateHigh WANHealthCheckRate = "high"` - `Name string` - `Physport int64` - `Priority int64` Priority of WAN for traffic loadbalancing. - `SiteID string` Identifier - `StaticAddressing WANStaticAddressing` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `Address string` A valid CIDR notation representing an IP range. - `GatewayAddress string` A valid IPv4 address. - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) wan, err := client.MagicTransit.Sites.WANs.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteWANEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", wan.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "health_check_rate": "low", "name": "name", "physport": 1, "priority": 0, "site_id": "023e105f4ecef8ad9ca31a8372d0c353", "static_addressing": { "address": "192.0.2.0/24", "gateway_address": "192.0.2.1", "secondary_address": "192.0.2.0/24" }, "vlan_tag": 42 }, "success": true } ``` ## Delete Site WAN `client.MagicTransit.Sites.WANs.Delete(ctx, siteID, wanID, body) (*WAN, error)` **delete** `/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}` Remove a specific Site WAN. ### Parameters - `siteID string` Identifier - `wanID string` Identifier - `body SiteWANDeleteParams` - `AccountID param.Field[string]` Identifier ### Returns - `type WAN struct{…}` - `ID string` Identifier - `HealthCheckRate WANHealthCheckRate` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `const WANHealthCheckRateLow WANHealthCheckRate = "low"` - `const WANHealthCheckRateMid WANHealthCheckRate = "mid"` - `const WANHealthCheckRateHigh WANHealthCheckRate = "high"` - `Name string` - `Physport int64` - `Priority int64` Priority of WAN for traffic loadbalancing. - `SiteID string` Identifier - `StaticAddressing WANStaticAddressing` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `Address string` A valid CIDR notation representing an IP range. - `GatewayAddress string` A valid IPv4 address. - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) wan, err := client.MagicTransit.Sites.WANs.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteWANDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", wan.ID) } ``` #### 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": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "health_check_rate": "low", "name": "name", "physport": 1, "priority": 0, "site_id": "023e105f4ecef8ad9ca31a8372d0c353", "static_addressing": { "address": "192.0.2.0/24", "gateway_address": "192.0.2.1", "secondary_address": "192.0.2.0/24" }, "vlan_tag": 42 }, "success": true } ``` ## Domain Types ### WAN - `type WAN struct{…}` - `ID string` Identifier - `HealthCheckRate WANHealthCheckRate` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `const WANHealthCheckRateLow WANHealthCheckRate = "low"` - `const WANHealthCheckRateMid WANHealthCheckRate = "mid"` - `const WANHealthCheckRateHigh WANHealthCheckRate = "high"` - `Name string` - `Physport int64` - `Priority int64` Priority of WAN for traffic loadbalancing. - `SiteID string` Identifier - `StaticAddressing WANStaticAddressing` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `Address string` A valid CIDR notation representing an IP range. - `GatewayAddress string` A valid IPv4 address. - `SecondaryAddress string` A valid CIDR notation representing an IP range. - `VlanTag int64` VLAN ID. Use zero for untagged. ### WAN Static Addressing - `type WANStaticAddressing struct{…}` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `Address string` A valid CIDR notation representing an IP range. - `GatewayAddress string` A valid IPv4 address. - `SecondaryAddress string` A valid CIDR notation representing an IP range. # Connectors ## List Connectors `client.MagicTransit.Connectors.List(ctx, query) (*SinglePage[ConnectorListResponse], error)` **get** `/accounts/{account_id}/magic/connectors` List Connectors ### Parameters - `query ConnectorListParams` - `AccountID param.Field[string]` Account identifier ### Returns - `type ConnectorListResponse struct{…}` - `ID string` - `Activated bool` - `InterruptWindowDaysOfWeek []ConnectorListResponseInterruptWindowDaysOfWeek` Allowed days of the week for upgrades. Default is all days. - `const ConnectorListResponseInterruptWindowDaysOfWeekSunday ConnectorListResponseInterruptWindowDaysOfWeek = "Sunday"` - `const ConnectorListResponseInterruptWindowDaysOfWeekMonday ConnectorListResponseInterruptWindowDaysOfWeek = "Monday"` - `const ConnectorListResponseInterruptWindowDaysOfWeekTuesday ConnectorListResponseInterruptWindowDaysOfWeek = "Tuesday"` - `const ConnectorListResponseInterruptWindowDaysOfWeekWednesday ConnectorListResponseInterruptWindowDaysOfWeek = "Wednesday"` - `const ConnectorListResponseInterruptWindowDaysOfWeekThursday ConnectorListResponseInterruptWindowDaysOfWeek = "Thursday"` - `const ConnectorListResponseInterruptWindowDaysOfWeekFriday ConnectorListResponseInterruptWindowDaysOfWeek = "Friday"` - `const ConnectorListResponseInterruptWindowDaysOfWeekSaturday ConnectorListResponseInterruptWindowDaysOfWeek = "Saturday"` - `InterruptWindowDurationHours float64` - `InterruptWindowEmbargoDates []string` List of dates (YYYY-MM-DD) when upgrades are blocked. - `InterruptWindowHourOfDay float64` - `LastUpdated string` - `Notes string` - `Timezone string` - `Device ConnectorListResponseDevice` - `ID string` - `SerialNumber string` - `LastHeartbeat string` - `LastSeenVersion string` - `LicenseKey string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.MagicTransit.Connectors.List(context.TODO(), magic_transit.ConnectorListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": [ { "id": "id", "activated": true, "interrupt_window_days_of_week": [ "Sunday" ], "interrupt_window_duration_hours": 1, "interrupt_window_embargo_dates": [ "string" ], "interrupt_window_hour_of_day": 0, "last_updated": "last_updated", "notes": "notes", "timezone": "timezone", "device": { "id": "id", "serial_number": "serial_number" }, "last_heartbeat": "last_heartbeat", "last_seen_version": "last_seen_version", "license_key": "license_key" } ], "success": true } ``` ## Fetch Connector `client.MagicTransit.Connectors.Get(ctx, connectorID, query) (*ConnectorGetResponse, error)` **get** `/accounts/{account_id}/magic/connectors/{connector_id}` Fetch Connector ### Parameters - `connectorID string` - `query ConnectorGetParams` - `AccountID param.Field[string]` Account identifier ### Returns - `type ConnectorGetResponse struct{…}` - `ID string` - `Activated bool` - `InterruptWindowDaysOfWeek []ConnectorGetResponseInterruptWindowDaysOfWeek` Allowed days of the week for upgrades. Default is all days. - `const ConnectorGetResponseInterruptWindowDaysOfWeekSunday ConnectorGetResponseInterruptWindowDaysOfWeek = "Sunday"` - `const ConnectorGetResponseInterruptWindowDaysOfWeekMonday ConnectorGetResponseInterruptWindowDaysOfWeek = "Monday"` - `const ConnectorGetResponseInterruptWindowDaysOfWeekTuesday ConnectorGetResponseInterruptWindowDaysOfWeek = "Tuesday"` - `const ConnectorGetResponseInterruptWindowDaysOfWeekWednesday ConnectorGetResponseInterruptWindowDaysOfWeek = "Wednesday"` - `const ConnectorGetResponseInterruptWindowDaysOfWeekThursday ConnectorGetResponseInterruptWindowDaysOfWeek = "Thursday"` - `const ConnectorGetResponseInterruptWindowDaysOfWeekFriday ConnectorGetResponseInterruptWindowDaysOfWeek = "Friday"` - `const ConnectorGetResponseInterruptWindowDaysOfWeekSaturday ConnectorGetResponseInterruptWindowDaysOfWeek = "Saturday"` - `InterruptWindowDurationHours float64` - `InterruptWindowEmbargoDates []string` List of dates (YYYY-MM-DD) when upgrades are blocked. - `InterruptWindowHourOfDay float64` - `LastUpdated string` - `Notes string` - `Timezone string` - `Device ConnectorGetResponseDevice` - `ID string` - `SerialNumber string` - `LastHeartbeat string` - `LastSeenVersion string` - `LicenseKey string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) connector, err := client.MagicTransit.Connectors.Get( context.TODO(), "connector_id", magic_transit.ConnectorGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", connector.ID) } ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "id": "id", "activated": true, "interrupt_window_days_of_week": [ "Sunday" ], "interrupt_window_duration_hours": 1, "interrupt_window_embargo_dates": [ "string" ], "interrupt_window_hour_of_day": 0, "last_updated": "last_updated", "notes": "notes", "timezone": "timezone", "device": { "id": "id", "serial_number": "serial_number" }, "last_heartbeat": "last_heartbeat", "last_seen_version": "last_seen_version", "license_key": "license_key" }, "success": true } ``` ## Add a connector to your account `client.MagicTransit.Connectors.New(ctx, params) (*ConnectorNewResponse, error)` **post** `/accounts/{account_id}/magic/connectors` Add a connector to your account ### Parameters - `params ConnectorNewParams` - `AccountID param.Field[string]` Path param: Account identifier - `Device param.Field[ConnectorNewParamsDevice]` Body param: Exactly one of id, serial_number, or provision_license must be provided. - `ID string` - `ProvisionLicense bool` When true, create and provision a new licence key for the connector. - `SerialNumber string` - `Activated param.Field[bool]` Body param - `InterruptWindowDaysOfWeek param.Field[[]ConnectorNewParamsInterruptWindowDaysOfWeek]` Body param: Allowed days of the week for upgrades. Default is all days. - `const ConnectorNewParamsInterruptWindowDaysOfWeekSunday ConnectorNewParamsInterruptWindowDaysOfWeek = "Sunday"` - `const ConnectorNewParamsInterruptWindowDaysOfWeekMonday ConnectorNewParamsInterruptWindowDaysOfWeek = "Monday"` - `const ConnectorNewParamsInterruptWindowDaysOfWeekTuesday ConnectorNewParamsInterruptWindowDaysOfWeek = "Tuesday"` - `const ConnectorNewParamsInterruptWindowDaysOfWeekWednesday ConnectorNewParamsInterruptWindowDaysOfWeek = "Wednesday"` - `const ConnectorNewParamsInterruptWindowDaysOfWeekThursday ConnectorNewParamsInterruptWindowDaysOfWeek = "Thursday"` - `const ConnectorNewParamsInterruptWindowDaysOfWeekFriday ConnectorNewParamsInterruptWindowDaysOfWeek = "Friday"` - `const ConnectorNewParamsInterruptWindowDaysOfWeekSaturday ConnectorNewParamsInterruptWindowDaysOfWeek = "Saturday"` - `InterruptWindowDurationHours param.Field[float64]` Body param - `InterruptWindowEmbargoDates param.Field[[]string]` Body param: List of dates (YYYY-MM-DD) when upgrades are blocked. - `InterruptWindowHourOfDay param.Field[float64]` Body param - `Notes param.Field[string]` Body param - `Timezone param.Field[string]` Body param ### Returns - `type ConnectorNewResponse struct{…}` - `ID string` - `Activated bool` - `InterruptWindowDaysOfWeek []ConnectorNewResponseInterruptWindowDaysOfWeek` Allowed days of the week for upgrades. Default is all days. - `const ConnectorNewResponseInterruptWindowDaysOfWeekSunday ConnectorNewResponseInterruptWindowDaysOfWeek = "Sunday"` - `const ConnectorNewResponseInterruptWindowDaysOfWeekMonday ConnectorNewResponseInterruptWindowDaysOfWeek = "Monday"` - `const ConnectorNewResponseInterruptWindowDaysOfWeekTuesday ConnectorNewResponseInterruptWindowDaysOfWeek = "Tuesday"` - `const ConnectorNewResponseInterruptWindowDaysOfWeekWednesday ConnectorNewResponseInterruptWindowDaysOfWeek = "Wednesday"` - `const ConnectorNewResponseInterruptWindowDaysOfWeekThursday ConnectorNewResponseInterruptWindowDaysOfWeek = "Thursday"` - `const ConnectorNewResponseInterruptWindowDaysOfWeekFriday ConnectorNewResponseInterruptWindowDaysOfWeek = "Friday"` - `const ConnectorNewResponseInterruptWindowDaysOfWeekSaturday ConnectorNewResponseInterruptWindowDaysOfWeek = "Saturday"` - `InterruptWindowDurationHours float64` - `InterruptWindowEmbargoDates []string` List of dates (YYYY-MM-DD) when upgrades are blocked. - `InterruptWindowHourOfDay float64` - `LastUpdated string` - `Notes string` - `Timezone string` - `Device ConnectorNewResponseDevice` - `ID string` - `SerialNumber string` - `LastHeartbeat string` - `LastSeenVersion string` - `LicenseKey string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) connector, err := client.MagicTransit.Connectors.New(context.TODO(), magic_transit.ConnectorNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Device: cloudflare.F(magic_transit.ConnectorNewParamsDevice{ }), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", connector.ID) } ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "id": "id", "activated": true, "interrupt_window_days_of_week": [ "Sunday" ], "interrupt_window_duration_hours": 1, "interrupt_window_embargo_dates": [ "string" ], "interrupt_window_hour_of_day": 0, "last_updated": "last_updated", "notes": "notes", "timezone": "timezone", "device": { "id": "id", "serial_number": "serial_number" }, "last_heartbeat": "last_heartbeat", "last_seen_version": "last_seen_version", "license_key": "license_key" }, "success": true } ``` ## Replace Connector or Re-provision License Key `client.MagicTransit.Connectors.Update(ctx, connectorID, params) (*ConnectorUpdateResponse, error)` **put** `/accounts/{account_id}/magic/connectors/{connector_id}` Replace Connector or Re-provision License Key ### Parameters - `connectorID string` - `params ConnectorUpdateParams` - `AccountID param.Field[string]` Path param: Account identifier - `Activated param.Field[bool]` Body param - `InterruptWindowDaysOfWeek param.Field[[]ConnectorUpdateParamsInterruptWindowDaysOfWeek]` Body param: Allowed days of the week for upgrades. Default is all days. - `const ConnectorUpdateParamsInterruptWindowDaysOfWeekSunday ConnectorUpdateParamsInterruptWindowDaysOfWeek = "Sunday"` - `const ConnectorUpdateParamsInterruptWindowDaysOfWeekMonday ConnectorUpdateParamsInterruptWindowDaysOfWeek = "Monday"` - `const ConnectorUpdateParamsInterruptWindowDaysOfWeekTuesday ConnectorUpdateParamsInterruptWindowDaysOfWeek = "Tuesday"` - `const ConnectorUpdateParamsInterruptWindowDaysOfWeekWednesday ConnectorUpdateParamsInterruptWindowDaysOfWeek = "Wednesday"` - `const ConnectorUpdateParamsInterruptWindowDaysOfWeekThursday ConnectorUpdateParamsInterruptWindowDaysOfWeek = "Thursday"` - `const ConnectorUpdateParamsInterruptWindowDaysOfWeekFriday ConnectorUpdateParamsInterruptWindowDaysOfWeek = "Friday"` - `const ConnectorUpdateParamsInterruptWindowDaysOfWeekSaturday ConnectorUpdateParamsInterruptWindowDaysOfWeek = "Saturday"` - `InterruptWindowDurationHours param.Field[float64]` Body param - `InterruptWindowEmbargoDates param.Field[[]string]` Body param: List of dates (YYYY-MM-DD) when upgrades are blocked. - `InterruptWindowHourOfDay param.Field[float64]` Body param - `Notes param.Field[string]` Body param - `ProvisionLicense param.Field[bool]` Body param: When true, regenerate license key for the connector. - `Timezone param.Field[string]` Body param ### Returns - `type ConnectorUpdateResponse struct{…}` - `ID string` - `Activated bool` - `InterruptWindowDaysOfWeek []ConnectorUpdateResponseInterruptWindowDaysOfWeek` Allowed days of the week for upgrades. Default is all days. - `const ConnectorUpdateResponseInterruptWindowDaysOfWeekSunday ConnectorUpdateResponseInterruptWindowDaysOfWeek = "Sunday"` - `const ConnectorUpdateResponseInterruptWindowDaysOfWeekMonday ConnectorUpdateResponseInterruptWindowDaysOfWeek = "Monday"` - `const ConnectorUpdateResponseInterruptWindowDaysOfWeekTuesday ConnectorUpdateResponseInterruptWindowDaysOfWeek = "Tuesday"` - `const ConnectorUpdateResponseInterruptWindowDaysOfWeekWednesday ConnectorUpdateResponseInterruptWindowDaysOfWeek = "Wednesday"` - `const ConnectorUpdateResponseInterruptWindowDaysOfWeekThursday ConnectorUpdateResponseInterruptWindowDaysOfWeek = "Thursday"` - `const ConnectorUpdateResponseInterruptWindowDaysOfWeekFriday ConnectorUpdateResponseInterruptWindowDaysOfWeek = "Friday"` - `const ConnectorUpdateResponseInterruptWindowDaysOfWeekSaturday ConnectorUpdateResponseInterruptWindowDaysOfWeek = "Saturday"` - `InterruptWindowDurationHours float64` - `InterruptWindowEmbargoDates []string` List of dates (YYYY-MM-DD) when upgrades are blocked. - `InterruptWindowHourOfDay float64` - `LastUpdated string` - `Notes string` - `Timezone string` - `Device ConnectorUpdateResponseDevice` - `ID string` - `SerialNumber string` - `LastHeartbeat string` - `LastSeenVersion string` - `LicenseKey string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) connector, err := client.MagicTransit.Connectors.Update( context.TODO(), "connector_id", magic_transit.ConnectorUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", connector.ID) } ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "id": "id", "activated": true, "interrupt_window_days_of_week": [ "Sunday" ], "interrupt_window_duration_hours": 1, "interrupt_window_embargo_dates": [ "string" ], "interrupt_window_hour_of_day": 0, "last_updated": "last_updated", "notes": "notes", "timezone": "timezone", "device": { "id": "id", "serial_number": "serial_number" }, "last_heartbeat": "last_heartbeat", "last_seen_version": "last_seen_version", "license_key": "license_key" }, "success": true } ``` ## Edit Connector to update specific properties or Re-provision License Key `client.MagicTransit.Connectors.Edit(ctx, connectorID, params) (*ConnectorEditResponse, error)` **patch** `/accounts/{account_id}/magic/connectors/{connector_id}` Edit Connector to update specific properties or Re-provision License Key ### Parameters - `connectorID string` - `params ConnectorEditParams` - `AccountID param.Field[string]` Path param: Account identifier - `Activated param.Field[bool]` Body param - `InterruptWindowDaysOfWeek param.Field[[]ConnectorEditParamsInterruptWindowDaysOfWeek]` Body param: Allowed days of the week for upgrades. Default is all days. - `const ConnectorEditParamsInterruptWindowDaysOfWeekSunday ConnectorEditParamsInterruptWindowDaysOfWeek = "Sunday"` - `const ConnectorEditParamsInterruptWindowDaysOfWeekMonday ConnectorEditParamsInterruptWindowDaysOfWeek = "Monday"` - `const ConnectorEditParamsInterruptWindowDaysOfWeekTuesday ConnectorEditParamsInterruptWindowDaysOfWeek = "Tuesday"` - `const ConnectorEditParamsInterruptWindowDaysOfWeekWednesday ConnectorEditParamsInterruptWindowDaysOfWeek = "Wednesday"` - `const ConnectorEditParamsInterruptWindowDaysOfWeekThursday ConnectorEditParamsInterruptWindowDaysOfWeek = "Thursday"` - `const ConnectorEditParamsInterruptWindowDaysOfWeekFriday ConnectorEditParamsInterruptWindowDaysOfWeek = "Friday"` - `const ConnectorEditParamsInterruptWindowDaysOfWeekSaturday ConnectorEditParamsInterruptWindowDaysOfWeek = "Saturday"` - `InterruptWindowDurationHours param.Field[float64]` Body param - `InterruptWindowEmbargoDates param.Field[[]string]` Body param: List of dates (YYYY-MM-DD) when upgrades are blocked. - `InterruptWindowHourOfDay param.Field[float64]` Body param - `Notes param.Field[string]` Body param - `ProvisionLicense param.Field[bool]` Body param: When true, regenerate license key for the connector. - `Timezone param.Field[string]` Body param ### Returns - `type ConnectorEditResponse struct{…}` - `ID string` - `Activated bool` - `InterruptWindowDaysOfWeek []ConnectorEditResponseInterruptWindowDaysOfWeek` Allowed days of the week for upgrades. Default is all days. - `const ConnectorEditResponseInterruptWindowDaysOfWeekSunday ConnectorEditResponseInterruptWindowDaysOfWeek = "Sunday"` - `const ConnectorEditResponseInterruptWindowDaysOfWeekMonday ConnectorEditResponseInterruptWindowDaysOfWeek = "Monday"` - `const ConnectorEditResponseInterruptWindowDaysOfWeekTuesday ConnectorEditResponseInterruptWindowDaysOfWeek = "Tuesday"` - `const ConnectorEditResponseInterruptWindowDaysOfWeekWednesday ConnectorEditResponseInterruptWindowDaysOfWeek = "Wednesday"` - `const ConnectorEditResponseInterruptWindowDaysOfWeekThursday ConnectorEditResponseInterruptWindowDaysOfWeek = "Thursday"` - `const ConnectorEditResponseInterruptWindowDaysOfWeekFriday ConnectorEditResponseInterruptWindowDaysOfWeek = "Friday"` - `const ConnectorEditResponseInterruptWindowDaysOfWeekSaturday ConnectorEditResponseInterruptWindowDaysOfWeek = "Saturday"` - `InterruptWindowDurationHours float64` - `InterruptWindowEmbargoDates []string` List of dates (YYYY-MM-DD) when upgrades are blocked. - `InterruptWindowHourOfDay float64` - `LastUpdated string` - `Notes string` - `Timezone string` - `Device ConnectorEditResponseDevice` - `ID string` - `SerialNumber string` - `LastHeartbeat string` - `LastSeenVersion string` - `LicenseKey string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.MagicTransit.Connectors.Edit( context.TODO(), "connector_id", magic_transit.ConnectorEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "id": "id", "activated": true, "interrupt_window_days_of_week": [ "Sunday" ], "interrupt_window_duration_hours": 1, "interrupt_window_embargo_dates": [ "string" ], "interrupt_window_hour_of_day": 0, "last_updated": "last_updated", "notes": "notes", "timezone": "timezone", "device": { "id": "id", "serial_number": "serial_number" }, "last_heartbeat": "last_heartbeat", "last_seen_version": "last_seen_version", "license_key": "license_key" }, "success": true } ``` ## Remove a connector from your account `client.MagicTransit.Connectors.Delete(ctx, connectorID, body) (*ConnectorDeleteResponse, error)` **delete** `/accounts/{account_id}/magic/connectors/{connector_id}` Remove a connector from your account ### Parameters - `connectorID string` - `body ConnectorDeleteParams` - `AccountID param.Field[string]` Account identifier ### Returns - `type ConnectorDeleteResponse struct{…}` - `ID string` - `Activated bool` - `InterruptWindowDaysOfWeek []ConnectorDeleteResponseInterruptWindowDaysOfWeek` Allowed days of the week for upgrades. Default is all days. - `const ConnectorDeleteResponseInterruptWindowDaysOfWeekSunday ConnectorDeleteResponseInterruptWindowDaysOfWeek = "Sunday"` - `const ConnectorDeleteResponseInterruptWindowDaysOfWeekMonday ConnectorDeleteResponseInterruptWindowDaysOfWeek = "Monday"` - `const ConnectorDeleteResponseInterruptWindowDaysOfWeekTuesday ConnectorDeleteResponseInterruptWindowDaysOfWeek = "Tuesday"` - `const ConnectorDeleteResponseInterruptWindowDaysOfWeekWednesday ConnectorDeleteResponseInterruptWindowDaysOfWeek = "Wednesday"` - `const ConnectorDeleteResponseInterruptWindowDaysOfWeekThursday ConnectorDeleteResponseInterruptWindowDaysOfWeek = "Thursday"` - `const ConnectorDeleteResponseInterruptWindowDaysOfWeekFriday ConnectorDeleteResponseInterruptWindowDaysOfWeek = "Friday"` - `const ConnectorDeleteResponseInterruptWindowDaysOfWeekSaturday ConnectorDeleteResponseInterruptWindowDaysOfWeek = "Saturday"` - `InterruptWindowDurationHours float64` - `InterruptWindowEmbargoDates []string` List of dates (YYYY-MM-DD) when upgrades are blocked. - `InterruptWindowHourOfDay float64` - `LastUpdated string` - `Notes string` - `Timezone string` - `Device ConnectorDeleteResponseDevice` - `ID string` - `SerialNumber string` - `LastHeartbeat string` - `LastSeenVersion string` - `LicenseKey string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) connector, err := client.MagicTransit.Connectors.Delete( context.TODO(), "connector_id", magic_transit.ConnectorDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", connector.ID) } ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "id": "id", "activated": true, "interrupt_window_days_of_week": [ "Sunday" ], "interrupt_window_duration_hours": 1, "interrupt_window_embargo_dates": [ "string" ], "interrupt_window_hour_of_day": 0, "last_updated": "last_updated", "notes": "notes", "timezone": "timezone", "device": { "id": "id", "serial_number": "serial_number" }, "last_heartbeat": "last_heartbeat", "last_seen_version": "last_seen_version", "license_key": "license_key" }, "success": true } ``` # Events ## List Events `client.MagicTransit.Connectors.Events.List(ctx, connectorID, params) (*ConnectorEventListResponse, error)` **get** `/accounts/{account_id}/magic/connectors/{connector_id}/telemetry/events` List Events ### Parameters - `connectorID string` - `params ConnectorEventListParams` - `AccountID param.Field[string]` Path param: Account identifier - `From param.Field[float64]` Query param - `To param.Field[float64]` Query param - `Cursor param.Field[string]` Query param - `K param.Field[string]` Query param: Filter by event kind - `Limit param.Field[float64]` Query param ### Returns - `type ConnectorEventListResponse struct{…}` - `Count float64` - `Items []ConnectorEventListResponseItem` - `A float64` Time the Event was collected (seconds since the Unix epoch) - `K string` Kind - `N float64` Sequence number, used to order events with the same timestamp - `T float64` Time the Event was recorded (seconds since the Unix epoch) - `Cursor string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) events, err := client.MagicTransit.Connectors.Events.List( context.TODO(), "connector_id", magic_transit.ConnectorEventListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), From: cloudflare.F(0.000000), To: cloudflare.F(0.000000), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", events.Count) } ``` #### Response ```json { "result": { "count": 0, "items": [ { "a": 0, "k": "k", "n": 0, "t": 0 } ], "cursor": "cursor" }, "success": true, "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ] } ``` ## Get Event `client.MagicTransit.Connectors.Events.Get(ctx, connectorID, eventT, eventN, query) (*ConnectorEventGetResponse, error)` **get** `/accounts/{account_id}/magic/connectors/{connector_id}/telemetry/events/{event_t}.{event_n}` Get Event ### Parameters - `connectorID string` - `eventT float64` - `eventN float64` - `query ConnectorEventGetParams` - `AccountID param.Field[string]` Account identifier ### Returns - `type ConnectorEventGetResponse struct{…}` Recorded Event - `E ConnectorEventGetResponseE` - `type ConnectorEventGetResponseEInit struct{…}` - `K ConnectorEventGetResponseEInitK` Initialized process - `const ConnectorEventGetResponseEInitKInit ConnectorEventGetResponseEInitK = "Init"` - `type ConnectorEventGetResponseELeave struct{…}` - `K ConnectorEventGetResponseELeaveK` Stopped process - `const ConnectorEventGetResponseELeaveKLeave ConnectorEventGetResponseELeaveK = "Leave"` - `type ConnectorEventGetResponseEStartAttestation struct{…}` - `K ConnectorEventGetResponseEStartAttestationK` Started attestation - `const ConnectorEventGetResponseEStartAttestationKStartAttestation ConnectorEventGetResponseEStartAttestationK = "StartAttestation"` - `type ConnectorEventGetResponseEFinishAttestationSuccess struct{…}` - `K ConnectorEventGetResponseEFinishAttestationSuccessK` Finished attestation - `const ConnectorEventGetResponseEFinishAttestationSuccessKFinishAttestationSuccess ConnectorEventGetResponseEFinishAttestationSuccessK = "FinishAttestationSuccess"` - `type ConnectorEventGetResponseEFinishAttestationFailure struct{…}` - `K ConnectorEventGetResponseEFinishAttestationFailureK` Failed attestation - `const ConnectorEventGetResponseEFinishAttestationFailureKFinishAttestationFailure ConnectorEventGetResponseEFinishAttestationFailureK = "FinishAttestationFailure"` - `type ConnectorEventGetResponseEStartRotateCryptKey struct{…}` - `K ConnectorEventGetResponseEStartRotateCryptKeyK` Started crypt key rotation - `const ConnectorEventGetResponseEStartRotateCryptKeyKStartRotateCryptKey ConnectorEventGetResponseEStartRotateCryptKeyK = "StartRotateCryptKey"` - `type ConnectorEventGetResponseEFinishRotateCryptKeySuccess struct{…}` - `K ConnectorEventGetResponseEFinishRotateCryptKeySuccessK` Finished crypt key rotation - `const ConnectorEventGetResponseEFinishRotateCryptKeySuccessKFinishRotateCryptKeySuccess ConnectorEventGetResponseEFinishRotateCryptKeySuccessK = "FinishRotateCryptKeySuccess"` - `type ConnectorEventGetResponseEFinishRotateCryptKeyFailure struct{…}` - `K ConnectorEventGetResponseEFinishRotateCryptKeyFailureK` Failed crypt key rotation - `const ConnectorEventGetResponseEFinishRotateCryptKeyFailureKFinishRotateCryptKeyFailure ConnectorEventGetResponseEFinishRotateCryptKeyFailureK = "FinishRotateCryptKeyFailure"` - `type ConnectorEventGetResponseEStartRotatePki struct{…}` - `K ConnectorEventGetResponseEStartRotatePkiK` Started PKI rotation - `const ConnectorEventGetResponseEStartRotatePkiKStartRotatePki ConnectorEventGetResponseEStartRotatePkiK = "StartRotatePki"` - `type ConnectorEventGetResponseEFinishRotatePkiSuccess struct{…}` - `K ConnectorEventGetResponseEFinishRotatePkiSuccessK` Finished PKI rotation - `const ConnectorEventGetResponseEFinishRotatePkiSuccessKFinishRotatePkiSuccess ConnectorEventGetResponseEFinishRotatePkiSuccessK = "FinishRotatePkiSuccess"` - `type ConnectorEventGetResponseEFinishRotatePkiFailure struct{…}` - `K ConnectorEventGetResponseEFinishRotatePkiFailureK` Failed PKI rotation - `const ConnectorEventGetResponseEFinishRotatePkiFailureKFinishRotatePkiFailure ConnectorEventGetResponseEFinishRotatePkiFailureK = "FinishRotatePkiFailure"` - `type ConnectorEventGetResponseEStartUpgrade struct{…}` - `K ConnectorEventGetResponseEStartUpgradeK` Started upgrade - `const ConnectorEventGetResponseEStartUpgradeKStartUpgrade ConnectorEventGetResponseEStartUpgradeK = "StartUpgrade"` - `URL string` Location of upgrade bundle - `type ConnectorEventGetResponseEFinishUpgradeSuccess struct{…}` - `K ConnectorEventGetResponseEFinishUpgradeSuccessK` Finished upgrade - `const ConnectorEventGetResponseEFinishUpgradeSuccessKFinishUpgradeSuccess ConnectorEventGetResponseEFinishUpgradeSuccessK = "FinishUpgradeSuccess"` - `type ConnectorEventGetResponseEFinishUpgradeFailure struct{…}` - `K ConnectorEventGetResponseEFinishUpgradeFailureK` Failed upgrade - `const ConnectorEventGetResponseEFinishUpgradeFailureKFinishUpgradeFailure ConnectorEventGetResponseEFinishUpgradeFailureK = "FinishUpgradeFailure"` - `type ConnectorEventGetResponseEReconcile struct{…}` - `K ConnectorEventGetResponseEReconcileK` Reconciled - `const ConnectorEventGetResponseEReconcileKReconcile ConnectorEventGetResponseEReconcileK = "Reconcile"` - `type ConnectorEventGetResponseEConfigureCloudflaredTunnel struct{…}` - `K ConnectorEventGetResponseEConfigureCloudflaredTunnelK` Configured Cloudflared tunnel - `const ConnectorEventGetResponseEConfigureCloudflaredTunnelKConfigureCloudflaredTunnel ConnectorEventGetResponseEConfigureCloudflaredTunnelK = "ConfigureCloudflaredTunnel"` - `N float64` Sequence number, used to order events with the same timestamp - `T float64` Time the Event was recorded (seconds since the Unix epoch) - `V string` Version ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) event, err := client.MagicTransit.Connectors.Events.Get( context.TODO(), "connector_id", 0.000000, 0.000000, magic_transit.ConnectorEventGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", event.E) } ``` #### Response ```json { "result": { "e": { "k": "Init" }, "n": 0, "t": 0, "v": "v" }, "success": true, "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ] } ``` # Latest ## Get latest Events `client.MagicTransit.Connectors.Events.Latest.List(ctx, connectorID, query) (*ConnectorEventLatestListResponse, error)` **get** `/accounts/{account_id}/magic/connectors/{connector_id}/telemetry/events/latest` Get latest Events ### Parameters - `connectorID string` - `query ConnectorEventLatestListParams` - `AccountID param.Field[string]` Account identifier ### Returns - `type ConnectorEventLatestListResponse struct{…}` - `Count float64` - `Items []ConnectorEventLatestListResponseItem` - `E ConnectorEventLatestListResponseItemsE` - `type ConnectorEventLatestListResponseItemsEInit struct{…}` - `K ConnectorEventLatestListResponseItemsEInitK` Initialized process - `const ConnectorEventLatestListResponseItemsEInitKInit ConnectorEventLatestListResponseItemsEInitK = "Init"` - `type ConnectorEventLatestListResponseItemsELeave struct{…}` - `K ConnectorEventLatestListResponseItemsELeaveK` Stopped process - `const ConnectorEventLatestListResponseItemsELeaveKLeave ConnectorEventLatestListResponseItemsELeaveK = "Leave"` - `type ConnectorEventLatestListResponseItemsEStartAttestation struct{…}` - `K ConnectorEventLatestListResponseItemsEStartAttestationK` Started attestation - `const ConnectorEventLatestListResponseItemsEStartAttestationKStartAttestation ConnectorEventLatestListResponseItemsEStartAttestationK = "StartAttestation"` - `type ConnectorEventLatestListResponseItemsEFinishAttestationSuccess struct{…}` - `K ConnectorEventLatestListResponseItemsEFinishAttestationSuccessK` Finished attestation - `const ConnectorEventLatestListResponseItemsEFinishAttestationSuccessKFinishAttestationSuccess ConnectorEventLatestListResponseItemsEFinishAttestationSuccessK = "FinishAttestationSuccess"` - `type ConnectorEventLatestListResponseItemsEFinishAttestationFailure struct{…}` - `K ConnectorEventLatestListResponseItemsEFinishAttestationFailureK` Failed attestation - `const ConnectorEventLatestListResponseItemsEFinishAttestationFailureKFinishAttestationFailure ConnectorEventLatestListResponseItemsEFinishAttestationFailureK = "FinishAttestationFailure"` - `type ConnectorEventLatestListResponseItemsEStartRotateCryptKey struct{…}` - `K ConnectorEventLatestListResponseItemsEStartRotateCryptKeyK` Started crypt key rotation - `const ConnectorEventLatestListResponseItemsEStartRotateCryptKeyKStartRotateCryptKey ConnectorEventLatestListResponseItemsEStartRotateCryptKeyK = "StartRotateCryptKey"` - `type ConnectorEventLatestListResponseItemsEFinishRotateCryptKeySuccess struct{…}` - `K ConnectorEventLatestListResponseItemsEFinishRotateCryptKeySuccessK` Finished crypt key rotation - `const ConnectorEventLatestListResponseItemsEFinishRotateCryptKeySuccessKFinishRotateCryptKeySuccess ConnectorEventLatestListResponseItemsEFinishRotateCryptKeySuccessK = "FinishRotateCryptKeySuccess"` - `type ConnectorEventLatestListResponseItemsEFinishRotateCryptKeyFailure struct{…}` - `K ConnectorEventLatestListResponseItemsEFinishRotateCryptKeyFailureK` Failed crypt key rotation - `const ConnectorEventLatestListResponseItemsEFinishRotateCryptKeyFailureKFinishRotateCryptKeyFailure ConnectorEventLatestListResponseItemsEFinishRotateCryptKeyFailureK = "FinishRotateCryptKeyFailure"` - `type ConnectorEventLatestListResponseItemsEStartRotatePki struct{…}` - `K ConnectorEventLatestListResponseItemsEStartRotatePkiK` Started PKI rotation - `const ConnectorEventLatestListResponseItemsEStartRotatePkiKStartRotatePki ConnectorEventLatestListResponseItemsEStartRotatePkiK = "StartRotatePki"` - `type ConnectorEventLatestListResponseItemsEFinishRotatePkiSuccess struct{…}` - `K ConnectorEventLatestListResponseItemsEFinishRotatePkiSuccessK` Finished PKI rotation - `const ConnectorEventLatestListResponseItemsEFinishRotatePkiSuccessKFinishRotatePkiSuccess ConnectorEventLatestListResponseItemsEFinishRotatePkiSuccessK = "FinishRotatePkiSuccess"` - `type ConnectorEventLatestListResponseItemsEFinishRotatePkiFailure struct{…}` - `K ConnectorEventLatestListResponseItemsEFinishRotatePkiFailureK` Failed PKI rotation - `const ConnectorEventLatestListResponseItemsEFinishRotatePkiFailureKFinishRotatePkiFailure ConnectorEventLatestListResponseItemsEFinishRotatePkiFailureK = "FinishRotatePkiFailure"` - `type ConnectorEventLatestListResponseItemsEStartUpgrade struct{…}` - `K ConnectorEventLatestListResponseItemsEStartUpgradeK` Started upgrade - `const ConnectorEventLatestListResponseItemsEStartUpgradeKStartUpgrade ConnectorEventLatestListResponseItemsEStartUpgradeK = "StartUpgrade"` - `URL string` Location of upgrade bundle - `type ConnectorEventLatestListResponseItemsEFinishUpgradeSuccess struct{…}` - `K ConnectorEventLatestListResponseItemsEFinishUpgradeSuccessK` Finished upgrade - `const ConnectorEventLatestListResponseItemsEFinishUpgradeSuccessKFinishUpgradeSuccess ConnectorEventLatestListResponseItemsEFinishUpgradeSuccessK = "FinishUpgradeSuccess"` - `type ConnectorEventLatestListResponseItemsEFinishUpgradeFailure struct{…}` - `K ConnectorEventLatestListResponseItemsEFinishUpgradeFailureK` Failed upgrade - `const ConnectorEventLatestListResponseItemsEFinishUpgradeFailureKFinishUpgradeFailure ConnectorEventLatestListResponseItemsEFinishUpgradeFailureK = "FinishUpgradeFailure"` - `type ConnectorEventLatestListResponseItemsEReconcile struct{…}` - `K ConnectorEventLatestListResponseItemsEReconcileK` Reconciled - `const ConnectorEventLatestListResponseItemsEReconcileKReconcile ConnectorEventLatestListResponseItemsEReconcileK = "Reconcile"` - `type ConnectorEventLatestListResponseItemsEConfigureCloudflaredTunnel struct{…}` - `K ConnectorEventLatestListResponseItemsEConfigureCloudflaredTunnelK` Configured Cloudflared tunnel - `const ConnectorEventLatestListResponseItemsEConfigureCloudflaredTunnelKConfigureCloudflaredTunnel ConnectorEventLatestListResponseItemsEConfigureCloudflaredTunnelK = "ConfigureCloudflaredTunnel"` - `N float64` Sequence number, used to order events with the same timestamp - `T float64` Time the Event was recorded (seconds since the Unix epoch) - `V string` Version ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) latests, err := client.MagicTransit.Connectors.Events.Latest.List( context.TODO(), "connector_id", magic_transit.ConnectorEventLatestListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", latests.Count) } ``` #### Response ```json { "result": { "count": 0, "items": [ { "e": { "k": "Init" }, "n": 0, "t": 0, "v": "v" } ] }, "success": true, "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ] } ``` # Snapshots ## List Snapshots `client.MagicTransit.Connectors.Snapshots.List(ctx, connectorID, params) (*ConnectorSnapshotListResponse, error)` **get** `/accounts/{account_id}/magic/connectors/{connector_id}/telemetry/snapshots` List Snapshots ### Parameters - `connectorID string` - `params ConnectorSnapshotListParams` - `AccountID param.Field[string]` Path param: Account identifier - `From param.Field[float64]` Query param - `To param.Field[float64]` Query param - `Cursor param.Field[string]` Query param - `Limit param.Field[float64]` Query param ### Returns - `type ConnectorSnapshotListResponse struct{…}` - `Count float64` - `Items []ConnectorSnapshotListResponseItem` - `A float64` Time the Snapshot was collected (seconds since the Unix epoch) - `T float64` Time the Snapshot was recorded (seconds since the Unix epoch) - `Cursor string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) snapshots, err := client.MagicTransit.Connectors.Snapshots.List( context.TODO(), "connector_id", magic_transit.ConnectorSnapshotListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), From: cloudflare.F(0.000000), To: cloudflare.F(0.000000), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", snapshots.Count) } ``` #### Response ```json { "result": { "count": 0, "items": [ { "a": 0, "t": 0 } ], "cursor": "cursor" }, "success": true, "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ] } ``` ## Get Snapshot `client.MagicTransit.Connectors.Snapshots.Get(ctx, connectorID, snapshotT, query) (*ConnectorSnapshotGetResponse, error)` **get** `/accounts/{account_id}/magic/connectors/{connector_id}/telemetry/snapshots/{snapshot_t}` Get Snapshot ### Parameters - `connectorID string` - `snapshotT float64` - `query ConnectorSnapshotGetParams` - `AccountID param.Field[string]` Account identifier ### Returns - `type ConnectorSnapshotGetResponse struct{…}` Snapshot - `CountReclaimFailures float64` Count of failures to reclaim space - `CountReclaimedPaths float64` Count of reclaimed paths - `CountRecordFailed float64` Count of failed snapshot recordings - `CountTransmitFailures float64` Count of failed snapshot transmissions - `T float64` Time the Snapshot was recorded (seconds since the Unix epoch) - `V string` Version - `Bonds []ConnectorSnapshotGetResponseBond` - `Name string` Name of the network interface - `Status string` Current status of the network interface - `CPUCount float64` Count of processors/cores - `CPUPressure10s float64` Percentage of time over a 10 second window that tasks were stalled - `CPUPressure300s float64` Percentage of time over a 5 minute window that tasks were stalled - `CPUPressure60s float64` Percentage of time over a 1 minute window that tasks were stalled - `CPUPressureTotalUs float64` Total stall time (microseconds) - `CPUTimeGuestMs float64` Time spent running a virtual CPU or guest OS (milliseconds) - `CPUTimeGuestNiceMs float64` Time spent running a niced guest (milliseconds) - `CPUTimeIdleMs float64` Time spent in idle state (milliseconds) - `CPUTimeIowaitMs float64` Time spent wait for I/O to complete (milliseconds) - `CPUTimeIrqMs float64` Time spent servicing interrupts (milliseconds) - `CPUTimeNiceMs float64` Time spent in low-priority user mode (milliseconds) - `CPUTimeSoftirqMs float64` Time spent servicing softirqs (milliseconds) - `CPUTimeStealMs float64` Time stolen (milliseconds) - `CPUTimeSystemMs float64` Time spent in system mode (milliseconds) - `CPUTimeUserMs float64` Time spent in user mode (milliseconds) - `Delta float64` Number of network operations applied during state transition - `DHCPLeases []ConnectorSnapshotGetResponseDHCPLease` - `ClientID string` Client ID of the device the IP Address was leased to - `ExpiryTime float64` Expiry time of the DHCP lease (seconds since the Unix epoch) - `Hostname string` Hostname of the device the IP Address was leased to - `InterfaceName string` Name of the network interface - `IPAddress string` IP Address that was leased - `MacAddress string` MAC Address of the device the IP Address was leased to - `Disks []ConnectorSnapshotGetResponseDisk` - `InProgress float64` I/Os currently in progress - `Major float64` Device major number - `Merged float64` Reads merged - `Minor float64` Device minor number - `Name string` Device name - `Reads float64` Reads completed successfully - `SectorsRead float64` Sectors read successfully - `SectorsWritten float64` Sectors written successfully - `TimeInProgressMs float64` Time spent doing I/Os (milliseconds) - `TimeReadingMs float64` Time spent reading (milliseconds) - `TimeWritingMs float64` Time spent writing (milliseconds) - `WeightedTimeInProgressMs float64` Weighted time spent doing I/Os (milliseconds) - `Writes float64` Writes completed - `WritesMerged float64` Writes merged - `Discards float64` Discards completed successfully - `DiscardsMerged float64` Discards merged - `Flushes float64` Flushes completed successfully - `SectorsDiscarded float64` Sectors discarded - `TimeDiscardingMs float64` Time spent discarding (milliseconds) - `TimeFlushingMs float64` Time spent flushing (milliseconds) - `Epsilon float64` Simulated number of network operations applied during state transition - `HaState string` Name of high availability state - `HaValue float64` Numeric value associated with high availability state (0 = disabled, 1 = active, 2 = standby, 3 = stopped, 4 = fault) - `Interfaces []ConnectorSnapshotGetResponseInterface` - `Name string` Name of the network interface - `Operstate string` UP/DOWN state of the network interface - `IPAddresses []ConnectorSnapshotGetResponseInterfacesIPAddress` - `InterfaceName string` Name of the network interface - `IPAddress string` IP address of the network interface - `Speed float64` Speed of the network interface (bits per second) - `IoPressureFull10s float64` Percentage of time over a 10 second window that all tasks were stalled - `IoPressureFull300s float64` Percentage of time over a 5 minute window that all tasks were stalled - `IoPressureFull60s float64` Percentage of time over a 1 minute window that all tasks were stalled - `IoPressureFullTotalUs float64` Total stall time (microseconds) - `IoPressureSome10s float64` Percentage of time over a 10 second window that some tasks were stalled - `IoPressureSome300s float64` Percentage of time over a 3 minute window that some tasks were stalled - `IoPressureSome60s float64` Percentage of time over a 1 minute window that some tasks were stalled - `IoPressureSomeTotalUs float64` Total stall time (microseconds) - `KernelBtime float64` Boot time (seconds since Unix epoch) - `KernelCtxt float64` Number of context switches that the system underwent - `KernelProcesses float64` Number of forks since boot - `KernelProcessesBlocked float64` Number of processes blocked waiting for I/O - `KernelProcessesRunning float64` Number of processes in runnable state - `LoadAverage15m float64` The fifteen-minute load average - `LoadAverage1m float64` The one-minute load average - `LoadAverage5m float64` The five-minute load average - `LoadAverageCur float64` Number of currently runnable kernel scheduling entities - `LoadAverageMax float64` Number of kernel scheduling entities that currently exist on the system - `MemoryActiveBytes float64` Memory that has been used more recently - `MemoryAnonHugepagesBytes float64` Non-file backed huge pages mapped into user-space page tables - `MemoryAnonPagesBytes float64` Non-file backed pages mapped into user-space page tables - `MemoryAvailableBytes float64` Estimate of how much memory is available for starting new applications - `MemoryBounceBytes float64` Memory used for block device bounce buffers - `MemoryBuffersBytes float64` Relatively temporary storage for raw disk blocks - `MemoryCachedBytes float64` In-memory cache for files read from the disk - `MemoryCmaFreeBytes float64` Free CMA (Contiguous Memory Allocator) pages - `MemoryCmaTotalBytes float64` Total CMA (Contiguous Memory Allocator) pages - `MemoryCommitLimitBytes float64` Total amount of memory currently available to be allocated on the system - `MemoryCommittedAsBytes float64` Amount of memory presently allocated on the system - `MemoryDirtyBytes float64` Memory which is waiting to get written back to the disk - `MemoryFreeBytes float64` The sum of LowFree and HighFree - `MemoryHighFreeBytes float64` Amount of free highmem - `MemoryHighTotalBytes float64` Total amount of highmem - `MemoryHugepagesFree float64` The number of huge pages in the pool that are not yet allocated - `MemoryHugepagesRsvd float64` Number of huge pages for which a commitment has been made, but no allocation has yet been made - `MemoryHugepagesSurp float64` Number of huge pages in the pool above the threshold - `MemoryHugepagesTotal float64` The size of the pool of huge pages - `MemoryHugepagesizeBytes float64` The size of huge pages - `MemoryInactiveBytes float64` Memory which has been less recently used - `MemoryKReclaimableBytes float64` Kernel allocations that the kernel will attempt to reclaim under memory pressure - `MemoryKernelStackBytes float64` Amount of memory allocated to kernel stacks - `MemoryLowFreeBytes float64` Amount of free lowmem - `MemoryLowTotalBytes float64` Total amount of lowmem - `MemoryMappedBytes float64` Files which have been mapped into memory - `MemoryPageTablesBytes float64` Amount of memory dedicated to the lowest level of page tables - `MemoryPerCPUBytes float64` Memory allocated to the per-cpu alloctor used to back per-cpu allocations - `MemoryPressureFull10s float64` Percentage of time over a 10 second window that all tasks were stalled - `MemoryPressureFull300s float64` Percentage of time over a 5 minute window that all tasks were stalled - `MemoryPressureFull60s float64` Percentage of time over a 1 minute window that all tasks were stalled - `MemoryPressureFullTotalUs float64` Total stall time (microseconds) - `MemoryPressureSome10s float64` Percentage of time over a 10 second window that some tasks were stalled - `MemoryPressureSome300s float64` Percentage of time over a 5 minute window that some tasks were stalled - `MemoryPressureSome60s float64` Percentage of time over a 1 minute window that some tasks were stalled - `MemoryPressureSomeTotalUs float64` Total stall time (microseconds) - `MemorySReclaimableBytes float64` Part of slab that can be reclaimed on memory pressure - `MemorySUnreclaimBytes float64` Part of slab that cannot be reclaimed on memory pressure - `MemorySecondaryPageTablesBytes float64` Amount of memory dedicated to the lowest level of page tables - `MemoryShmemBytes float64` Amount of memory consumed by tmpfs - `MemoryShmemHugepagesBytes float64` Memory used by shmem and tmpfs, allocated with huge pages - `MemoryShmemPmdMappedBytes float64` Shared memory mapped into user space with huge pages - `MemorySlabBytes float64` In-kernel data structures cache - `MemorySwapCachedBytes float64` Memory swapped out and back in while still in swap file - `MemorySwapFreeBytes float64` Amount of swap space that is currently unused - `MemorySwapTotalBytes float64` Total amount of swap space available - `MemoryTotalBytes float64` Total usable RAM - `MemoryVmallocChunkBytes float64` Largest contiguous block of vmalloc area which is free - `MemoryVmallocTotalBytes float64` Total size of vmalloc memory area - `MemoryVmallocUsedBytes float64` Amount of vmalloc area which is used - `MemoryWritebackBytes float64` Memory which is actively being written back to the disk - `MemoryWritebackTmpBytes float64` Memory used by FUSE for temporary writeback buffers - `MemoryZSwapBytes float64` Memory consumed by the zswap backend, compressed - `MemoryZSwappedBytes float64` Amount of anonymous memory stored in zswap, uncompressed - `Mounts []ConnectorSnapshotGetResponseMount` - `FileSystem string` File system on disk (EXT4, NTFS, etc.) - `Kind string` Kind of disk (HDD, SSD, etc.) - `MountPoint string` Path where disk is mounted - `Name string` Name of the disk mount - `AvailableBytes float64` Available disk size (bytes) - `IsReadOnly bool` Determines whether the disk is read-only - `IsRemovable bool` Determines whether the disk is removable - `TotalBytes float64` Total disk size (bytes) - `Netdevs []ConnectorSnapshotGetResponseNetdev` - `Name string` Name of the network device - `RecvBytes float64` Total bytes received - `RecvCompressed float64` Compressed packets received - `RecvDrop float64` Packets dropped - `RecvErrs float64` Bad packets received - `RecvFifo float64` FIFO overruns - `RecvFrame float64` Frame alignment errors - `RecvMulticast float64` Multicast packets received - `RecvPackets float64` Total packets received - `SentBytes float64` Total bytes transmitted - `SentCarrier float64` Number of packets not sent due to carrier errors - `SentColls float64` Number of collisions - `SentCompressed float64` Number of compressed packets transmitted - `SentDrop float64` Number of packets dropped during transmission - `SentErrs float64` Number of transmission errors - `SentFifo float64` FIFO overruns - `SentPackets float64` Total packets transmitted - `SnmpIcmpInAddrMaskReps float64` Number of ICMP Address Mask Reply messages received - `SnmpIcmpInAddrMasks float64` Number of ICMP Address Mask Request messages received - `SnmpIcmpInCsumErrors float64` Number of ICMP messages received with bad checksums - `SnmpIcmpInDestUnreachs float64` Number of ICMP Destination Unreachable messages received - `SnmpIcmpInEchoReps float64` Number of ICMP Echo Reply messages received - `SnmpIcmpInEchos float64` Number of ICMP Echo (request) messages received - `SnmpIcmpInErrors float64` Number of ICMP messages received with ICMP-specific errors - `SnmpIcmpInMsgs float64` Number of ICMP messages received - `SnmpIcmpInParmProbs float64` Number of ICMP Parameter Problem messages received - `SnmpIcmpInRedirects float64` Number of ICMP Redirect messages received - `SnmpIcmpInSrcQuenchs float64` Number of ICMP Source Quench messages received - `SnmpIcmpInTimeExcds float64` Number of ICMP Time Exceeded messages received - `SnmpIcmpInTimestampReps float64` Number of ICMP Address Mask Request messages received - `SnmpIcmpInTimestamps float64` Number of ICMP Timestamp (request) messages received - `SnmpIcmpOutAddrMaskReps float64` Number of ICMP Address Mask Reply messages sent - `SnmpIcmpOutAddrMasks float64` Number of ICMP Address Mask Request messages sent - `SnmpIcmpOutDestUnreachs float64` Number of ICMP Destination Unreachable messages sent - `SnmpIcmpOutEchoReps float64` Number of ICMP Echo Reply messages sent - `SnmpIcmpOutEchos float64` Number of ICMP Echo (request) messages sent - `SnmpIcmpOutErrors float64` Number of ICMP messages which this entity did not send due to ICMP-specific errors - `SnmpIcmpOutMsgs float64` Number of ICMP messages attempted to send - `SnmpIcmpOutParmProbs float64` Number of ICMP Parameter Problem messages sent - `SnmpIcmpOutRedirects float64` Number of ICMP Redirect messages sent - `SnmpIcmpOutSrcQuenchs float64` Number of ICMP Source Quench messages sent - `SnmpIcmpOutTimeExcds float64` Number of ICMP Time Exceeded messages sent - `SnmpIcmpOutTimestampReps float64` Number of ICMP Timestamp Reply messages sent - `SnmpIcmpOutTimestamps float64` Number of ICMP Timestamp (request) messages sent - `SnmpIPDefaultTTL float64` Default value of the Time-To-Live field of the IP header - `SnmpIPForwDatagrams float64` Number of datagrams forwarded to their final destination - `SnmpIPForwardingEnabled bool` Set when acting as an IP gateway - `SnmpIPFragCreates float64` Number of datagrams generated by fragmentation - `SnmpIPFragFails float64` Number of datagrams discarded because fragmentation failed - `SnmpIPFragOks float64` Number of datagrams successfully fragmented - `SnmpIPInAddrErrors float64` Number of input datagrams discarded due to errors in the IP address - `SnmpIPInDelivers float64` Number of input datagrams successfully delivered to IP user-protocols - `SnmpIPInDiscards float64` Number of input datagrams otherwise discarded - `SnmpIPInHdrErrors float64` Number of input datagrams discarded due to errors in the IP header - `SnmpIPInReceives float64` Number of input datagrams received from interfaces - `SnmpIPInUnknownProtos float64` Number of input datagrams discarded due unknown or unsupported protocol - `SnmpIPOutDiscards float64` Number of output datagrams otherwise discarded - `SnmpIPOutNoRoutes float64` Number of output datagrams discarded because no route matched - `SnmpIPOutRequests float64` Number of datagrams supplied for transmission - `SnmpIPReasmFails float64` Number of failures detected by the reassembly algorithm - `SnmpIPReasmOks float64` Number of datagrams successfully reassembled - `SnmpIPReasmReqds float64` Number of fragments received which needed to be reassembled - `SnmpIPReasmTimeout float64` Number of seconds fragments are held while awaiting reassembly - `SnmpTCPActiveOpens float64` Number of times TCP transitions to SYN-SENT from CLOSED - `SnmpTCPAttemptFails float64` Number of times TCP transitions to CLOSED from SYN-SENT or SYN-RCVD, plus transitions to LISTEN from SYN-RCVD - `SnmpTCPCurrEstab float64` Number of TCP connections in ESTABLISHED or CLOSE-WAIT - `SnmpTCPEstabResets float64` Number of times TCP transitions to CLOSED from ESTABLISHED or CLOSE-WAIT - `SnmpTCPInCsumErrors float64` Number of TCP segments received with checksum errors - `SnmpTCPInErrs float64` Number of TCP segments received in error - `SnmpTCPInSegs float64` Number of TCP segments received - `SnmpTCPMaxConn float64` Limit on the total number of TCP connections - `SnmpTCPOutRsts float64` Number of TCP segments sent with RST flag - `SnmpTCPOutSegs float64` Number of TCP segments sent - `SnmpTCPPassiveOpens float64` Number of times TCP transitions to SYN-RCVD from LISTEN - `SnmpTCPRetransSegs float64` Number of TCP segments retransmitted - `SnmpTCPRtoMax float64` Maximum value permitted by a TCP implementation for the retransmission timeout (milliseconds) - `SnmpTCPRtoMin float64` Minimum value permitted by a TCP implementation for the retransmission timeout (milliseconds) - `SnmpUdpInDatagrams float64` Number of UDP datagrams delivered to UDP applications - `SnmpUdpInErrors float64` Number of UDP datagrams failed to be delivered for reasons other than lack of application at the destination port - `SnmpUdpNoPorts float64` Number of UDP datagrams received for which there was not application at the destination port - `SnmpUdpOutDatagrams float64` Number of UDP datagrams sent - `SystemBootTimeS float64` Boottime of the system (seconds since the Unix epoch) - `Thermals []ConnectorSnapshotGetResponseThermal` - `Label string` Sensor identifier for the component - `CriticalCelcius float64` Critical failure temperature of the component (degrees Celsius) - `CurrentCelcius float64` Current temperature of the component (degrees Celsius) - `MaxCelcius float64` Maximum temperature of the component (degrees Celsius) - `Tunnels []ConnectorSnapshotGetResponseTunnel` - `HealthState string` Name of tunnel health state (unknown, healthy, degraded, down) - `HealthValue float64` Numeric value associated with tunnel state (0 = unknown, 1 = healthy, 2 = degraded, 3 = down) - `InterfaceName string` The tunnel interface name (i.e. xfrm1, xfrm3.99, etc.) - `TunnelID string` Tunnel identifier - `ProbedMtu float64` MTU as measured between the two ends of the tunnel - `RecentHealthyPings float64` Number of recent healthy pings for this tunnel - `RecentUnhealthyPings float64` Number of recent unhealthy pings for this tunnel - `UptimeIdleMs float64` Sum of how much time each core has spent idle - `UptimeTotalMs float64` Uptime of the system, including time spent in suspend ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) snapshot, err := client.MagicTransit.Connectors.Snapshots.Get( context.TODO(), "connector_id", 0.000000, magic_transit.ConnectorSnapshotGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", snapshot.CPUTimeIdleMs) } ``` #### Response ```json { "result": { "count_reclaim_failures": 0, "count_reclaimed_paths": 0, "count_record_failed": 0, "count_transmit_failures": 0, "t": 0, "v": "v", "bonds": [ { "name": "name", "status": "status" } ], "cpu_count": 0, "cpu_pressure_10s": 0, "cpu_pressure_300s": 0, "cpu_pressure_60s": 0, "cpu_pressure_total_us": 0, "cpu_time_guest_ms": 0, "cpu_time_guest_nice_ms": 0, "cpu_time_idle_ms": 0, "cpu_time_iowait_ms": 0, "cpu_time_irq_ms": 0, "cpu_time_nice_ms": 0, "cpu_time_softirq_ms": 0, "cpu_time_steal_ms": 0, "cpu_time_system_ms": 0, "cpu_time_user_ms": 0, "delta": 0, "dhcp_leases": [ { "client_id": "client_id", "expiry_time": 0, "hostname": "hostname", "interface_name": "interface_name", "ip_address": "ip_address", "mac_address": "mac_address" } ], "disks": [ { "in_progress": 0, "major": 0, "merged": 0, "minor": 0, "name": "name", "reads": 0, "sectors_read": 0, "sectors_written": 0, "time_in_progress_ms": 0, "time_reading_ms": 0, "time_writing_ms": 0, "weighted_time_in_progress_ms": 0, "writes": 0, "writes_merged": 0, "discards": 0, "discards_merged": 0, "flushes": 0, "sectors_discarded": 0, "time_discarding_ms": 0, "time_flushing_ms": 0 } ], "epsilon": 0, "ha_state": "ha_state", "ha_value": 0, "interfaces": [ { "name": "name", "operstate": "operstate", "ip_addresses": [ { "interface_name": "interface_name", "ip_address": "ip_address" } ], "speed": 0 } ], "io_pressure_full_10s": 0, "io_pressure_full_300s": 0, "io_pressure_full_60s": 0, "io_pressure_full_total_us": 0, "io_pressure_some_10s": 0, "io_pressure_some_300s": 0, "io_pressure_some_60s": 0, "io_pressure_some_total_us": 0, "kernel_btime": 0, "kernel_ctxt": 0, "kernel_processes": 0, "kernel_processes_blocked": 0, "kernel_processes_running": 0, "load_average_15m": 0, "load_average_1m": 0, "load_average_5m": 0, "load_average_cur": 0, "load_average_max": 0, "memory_active_bytes": 0, "memory_anon_hugepages_bytes": 0, "memory_anon_pages_bytes": 0, "memory_available_bytes": 0, "memory_bounce_bytes": 0, "memory_buffers_bytes": 0, "memory_cached_bytes": 0, "memory_cma_free_bytes": 0, "memory_cma_total_bytes": 0, "memory_commit_limit_bytes": 0, "memory_committed_as_bytes": 0, "memory_dirty_bytes": 0, "memory_free_bytes": 0, "memory_high_free_bytes": 0, "memory_high_total_bytes": 0, "memory_hugepages_free": 0, "memory_hugepages_rsvd": 0, "memory_hugepages_surp": 0, "memory_hugepages_total": 0, "memory_hugepagesize_bytes": 0, "memory_inactive_bytes": 0, "memory_k_reclaimable_bytes": 0, "memory_kernel_stack_bytes": 0, "memory_low_free_bytes": 0, "memory_low_total_bytes": 0, "memory_mapped_bytes": 0, "memory_page_tables_bytes": 0, "memory_per_cpu_bytes": 0, "memory_pressure_full_10s": 0, "memory_pressure_full_300s": 0, "memory_pressure_full_60s": 0, "memory_pressure_full_total_us": 0, "memory_pressure_some_10s": 0, "memory_pressure_some_300s": 0, "memory_pressure_some_60s": 0, "memory_pressure_some_total_us": 0, "memory_s_reclaimable_bytes": 0, "memory_s_unreclaim_bytes": 0, "memory_secondary_page_tables_bytes": 0, "memory_shmem_bytes": 0, "memory_shmem_hugepages_bytes": 0, "memory_shmem_pmd_mapped_bytes": 0, "memory_slab_bytes": 0, "memory_swap_cached_bytes": 0, "memory_swap_free_bytes": 0, "memory_swap_total_bytes": 0, "memory_total_bytes": 0, "memory_vmalloc_chunk_bytes": 0, "memory_vmalloc_total_bytes": 0, "memory_vmalloc_used_bytes": 0, "memory_writeback_bytes": 0, "memory_writeback_tmp_bytes": 0, "memory_z_swap_bytes": 0, "memory_z_swapped_bytes": 0, "mounts": [ { "file_system": "file_system", "kind": "kind", "mount_point": "mount_point", "name": "name", "available_bytes": 0, "is_read_only": true, "is_removable": true, "total_bytes": 0 } ], "netdevs": [ { "name": "name", "recv_bytes": 0, "recv_compressed": 0, "recv_drop": 0, "recv_errs": 0, "recv_fifo": 0, "recv_frame": 0, "recv_multicast": 0, "recv_packets": 0, "sent_bytes": 0, "sent_carrier": 0, "sent_colls": 0, "sent_compressed": 0, "sent_drop": 0, "sent_errs": 0, "sent_fifo": 0, "sent_packets": 0 } ], "snmp_icmp_in_addr_mask_reps": 0, "snmp_icmp_in_addr_masks": 0, "snmp_icmp_in_csum_errors": 0, "snmp_icmp_in_dest_unreachs": 0, "snmp_icmp_in_echo_reps": 0, "snmp_icmp_in_echos": 0, "snmp_icmp_in_errors": 0, "snmp_icmp_in_msgs": 0, "snmp_icmp_in_parm_probs": 0, "snmp_icmp_in_redirects": 0, "snmp_icmp_in_src_quenchs": 0, "snmp_icmp_in_time_excds": 0, "snmp_icmp_in_timestamp_reps": 0, "snmp_icmp_in_timestamps": 0, "snmp_icmp_out_addr_mask_reps": 0, "snmp_icmp_out_addr_masks": 0, "snmp_icmp_out_dest_unreachs": 0, "snmp_icmp_out_echo_reps": 0, "snmp_icmp_out_echos": 0, "snmp_icmp_out_errors": 0, "snmp_icmp_out_msgs": 0, "snmp_icmp_out_parm_probs": 0, "snmp_icmp_out_redirects": 0, "snmp_icmp_out_src_quenchs": 0, "snmp_icmp_out_time_excds": 0, "snmp_icmp_out_timestamp_reps": 0, "snmp_icmp_out_timestamps": 0, "snmp_ip_default_ttl": 0, "snmp_ip_forw_datagrams": 0, "snmp_ip_forwarding_enabled": true, "snmp_ip_frag_creates": 0, "snmp_ip_frag_fails": 0, "snmp_ip_frag_oks": 0, "snmp_ip_in_addr_errors": 0, "snmp_ip_in_delivers": 0, "snmp_ip_in_discards": 0, "snmp_ip_in_hdr_errors": 0, "snmp_ip_in_receives": 0, "snmp_ip_in_unknown_protos": 0, "snmp_ip_out_discards": 0, "snmp_ip_out_no_routes": 0, "snmp_ip_out_requests": 0, "snmp_ip_reasm_fails": 0, "snmp_ip_reasm_oks": 0, "snmp_ip_reasm_reqds": 0, "snmp_ip_reasm_timeout": 0, "snmp_tcp_active_opens": 0, "snmp_tcp_attempt_fails": 0, "snmp_tcp_curr_estab": 0, "snmp_tcp_estab_resets": 0, "snmp_tcp_in_csum_errors": 0, "snmp_tcp_in_errs": 0, "snmp_tcp_in_segs": 0, "snmp_tcp_max_conn": 0, "snmp_tcp_out_rsts": 0, "snmp_tcp_out_segs": 0, "snmp_tcp_passive_opens": 0, "snmp_tcp_retrans_segs": 0, "snmp_tcp_rto_max": 0, "snmp_tcp_rto_min": 0, "snmp_udp_in_datagrams": 0, "snmp_udp_in_errors": 0, "snmp_udp_no_ports": 0, "snmp_udp_out_datagrams": 0, "system_boot_time_s": 0, "thermals": [ { "label": "label", "critical_celcius": 0, "current_celcius": 0, "max_celcius": 0 } ], "tunnels": [ { "health_state": "health_state", "health_value": 0, "interface_name": "interface_name", "tunnel_id": "tunnel_id", "probed_mtu": 0, "recent_healthy_pings": 0, "recent_unhealthy_pings": 0 } ], "uptime_idle_ms": 0, "uptime_total_ms": 0 }, "success": true, "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ] } ``` # Latest ## Get latest Snapshots `client.MagicTransit.Connectors.Snapshots.Latest.List(ctx, connectorID, query) (*ConnectorSnapshotLatestListResponse, error)` **get** `/accounts/{account_id}/magic/connectors/{connector_id}/telemetry/snapshots/latest` Get latest Snapshots ### Parameters - `connectorID string` - `query ConnectorSnapshotLatestListParams` - `AccountID param.Field[string]` Account identifier ### Returns - `type ConnectorSnapshotLatestListResponse struct{…}` - `Count float64` - `Items []ConnectorSnapshotLatestListResponseItem` - `CountReclaimFailures float64` Count of failures to reclaim space - `CountReclaimedPaths float64` Count of reclaimed paths - `CountRecordFailed float64` Count of failed snapshot recordings - `CountTransmitFailures float64` Count of failed snapshot transmissions - `T float64` Time the Snapshot was recorded (seconds since the Unix epoch) - `V string` Version - `Bonds []ConnectorSnapshotLatestListResponseItemsBond` - `Name string` Name of the network interface - `Status string` Current status of the network interface - `CPUCount float64` Count of processors/cores - `CPUPressure10s float64` Percentage of time over a 10 second window that tasks were stalled - `CPUPressure300s float64` Percentage of time over a 5 minute window that tasks were stalled - `CPUPressure60s float64` Percentage of time over a 1 minute window that tasks were stalled - `CPUPressureTotalUs float64` Total stall time (microseconds) - `CPUTimeGuestMs float64` Time spent running a virtual CPU or guest OS (milliseconds) - `CPUTimeGuestNiceMs float64` Time spent running a niced guest (milliseconds) - `CPUTimeIdleMs float64` Time spent in idle state (milliseconds) - `CPUTimeIowaitMs float64` Time spent wait for I/O to complete (milliseconds) - `CPUTimeIrqMs float64` Time spent servicing interrupts (milliseconds) - `CPUTimeNiceMs float64` Time spent in low-priority user mode (milliseconds) - `CPUTimeSoftirqMs float64` Time spent servicing softirqs (milliseconds) - `CPUTimeStealMs float64` Time stolen (milliseconds) - `CPUTimeSystemMs float64` Time spent in system mode (milliseconds) - `CPUTimeUserMs float64` Time spent in user mode (milliseconds) - `Delta float64` Number of network operations applied during state transition - `DHCPLeases []ConnectorSnapshotLatestListResponseItemsDHCPLease` - `ClientID string` Client ID of the device the IP Address was leased to - `ExpiryTime float64` Expiry time of the DHCP lease (seconds since the Unix epoch) - `Hostname string` Hostname of the device the IP Address was leased to - `InterfaceName string` Name of the network interface - `IPAddress string` IP Address that was leased - `MacAddress string` MAC Address of the device the IP Address was leased to - `Disks []ConnectorSnapshotLatestListResponseItemsDisk` - `InProgress float64` I/Os currently in progress - `Major float64` Device major number - `Merged float64` Reads merged - `Minor float64` Device minor number - `Name string` Device name - `Reads float64` Reads completed successfully - `SectorsRead float64` Sectors read successfully - `SectorsWritten float64` Sectors written successfully - `TimeInProgressMs float64` Time spent doing I/Os (milliseconds) - `TimeReadingMs float64` Time spent reading (milliseconds) - `TimeWritingMs float64` Time spent writing (milliseconds) - `WeightedTimeInProgressMs float64` Weighted time spent doing I/Os (milliseconds) - `Writes float64` Writes completed - `WritesMerged float64` Writes merged - `Discards float64` Discards completed successfully - `DiscardsMerged float64` Discards merged - `Flushes float64` Flushes completed successfully - `SectorsDiscarded float64` Sectors discarded - `TimeDiscardingMs float64` Time spent discarding (milliseconds) - `TimeFlushingMs float64` Time spent flushing (milliseconds) - `Epsilon float64` Simulated number of network operations applied during state transition - `HaState string` Name of high availability state - `HaValue float64` Numeric value associated with high availability state (0 = disabled, 1 = active, 2 = standby, 3 = stopped, 4 = fault) - `Interfaces []ConnectorSnapshotLatestListResponseItemsInterface` - `Name string` Name of the network interface - `Operstate string` UP/DOWN state of the network interface - `IPAddresses []ConnectorSnapshotLatestListResponseItemsInterfacesIPAddress` - `InterfaceName string` Name of the network interface - `IPAddress string` IP address of the network interface - `Speed float64` Speed of the network interface (bits per second) - `IoPressureFull10s float64` Percentage of time over a 10 second window that all tasks were stalled - `IoPressureFull300s float64` Percentage of time over a 5 minute window that all tasks were stalled - `IoPressureFull60s float64` Percentage of time over a 1 minute window that all tasks were stalled - `IoPressureFullTotalUs float64` Total stall time (microseconds) - `IoPressureSome10s float64` Percentage of time over a 10 second window that some tasks were stalled - `IoPressureSome300s float64` Percentage of time over a 3 minute window that some tasks were stalled - `IoPressureSome60s float64` Percentage of time over a 1 minute window that some tasks were stalled - `IoPressureSomeTotalUs float64` Total stall time (microseconds) - `KernelBtime float64` Boot time (seconds since Unix epoch) - `KernelCtxt float64` Number of context switches that the system underwent - `KernelProcesses float64` Number of forks since boot - `KernelProcessesBlocked float64` Number of processes blocked waiting for I/O - `KernelProcessesRunning float64` Number of processes in runnable state - `LoadAverage15m float64` The fifteen-minute load average - `LoadAverage1m float64` The one-minute load average - `LoadAverage5m float64` The five-minute load average - `LoadAverageCur float64` Number of currently runnable kernel scheduling entities - `LoadAverageMax float64` Number of kernel scheduling entities that currently exist on the system - `MemoryActiveBytes float64` Memory that has been used more recently - `MemoryAnonHugepagesBytes float64` Non-file backed huge pages mapped into user-space page tables - `MemoryAnonPagesBytes float64` Non-file backed pages mapped into user-space page tables - `MemoryAvailableBytes float64` Estimate of how much memory is available for starting new applications - `MemoryBounceBytes float64` Memory used for block device bounce buffers - `MemoryBuffersBytes float64` Relatively temporary storage for raw disk blocks - `MemoryCachedBytes float64` In-memory cache for files read from the disk - `MemoryCmaFreeBytes float64` Free CMA (Contiguous Memory Allocator) pages - `MemoryCmaTotalBytes float64` Total CMA (Contiguous Memory Allocator) pages - `MemoryCommitLimitBytes float64` Total amount of memory currently available to be allocated on the system - `MemoryCommittedAsBytes float64` Amount of memory presently allocated on the system - `MemoryDirtyBytes float64` Memory which is waiting to get written back to the disk - `MemoryFreeBytes float64` The sum of LowFree and HighFree - `MemoryHighFreeBytes float64` Amount of free highmem - `MemoryHighTotalBytes float64` Total amount of highmem - `MemoryHugepagesFree float64` The number of huge pages in the pool that are not yet allocated - `MemoryHugepagesRsvd float64` Number of huge pages for which a commitment has been made, but no allocation has yet been made - `MemoryHugepagesSurp float64` Number of huge pages in the pool above the threshold - `MemoryHugepagesTotal float64` The size of the pool of huge pages - `MemoryHugepagesizeBytes float64` The size of huge pages - `MemoryInactiveBytes float64` Memory which has been less recently used - `MemoryKReclaimableBytes float64` Kernel allocations that the kernel will attempt to reclaim under memory pressure - `MemoryKernelStackBytes float64` Amount of memory allocated to kernel stacks - `MemoryLowFreeBytes float64` Amount of free lowmem - `MemoryLowTotalBytes float64` Total amount of lowmem - `MemoryMappedBytes float64` Files which have been mapped into memory - `MemoryPageTablesBytes float64` Amount of memory dedicated to the lowest level of page tables - `MemoryPerCPUBytes float64` Memory allocated to the per-cpu alloctor used to back per-cpu allocations - `MemoryPressureFull10s float64` Percentage of time over a 10 second window that all tasks were stalled - `MemoryPressureFull300s float64` Percentage of time over a 5 minute window that all tasks were stalled - `MemoryPressureFull60s float64` Percentage of time over a 1 minute window that all tasks were stalled - `MemoryPressureFullTotalUs float64` Total stall time (microseconds) - `MemoryPressureSome10s float64` Percentage of time over a 10 second window that some tasks were stalled - `MemoryPressureSome300s float64` Percentage of time over a 5 minute window that some tasks were stalled - `MemoryPressureSome60s float64` Percentage of time over a 1 minute window that some tasks were stalled - `MemoryPressureSomeTotalUs float64` Total stall time (microseconds) - `MemorySReclaimableBytes float64` Part of slab that can be reclaimed on memory pressure - `MemorySUnreclaimBytes float64` Part of slab that cannot be reclaimed on memory pressure - `MemorySecondaryPageTablesBytes float64` Amount of memory dedicated to the lowest level of page tables - `MemoryShmemBytes float64` Amount of memory consumed by tmpfs - `MemoryShmemHugepagesBytes float64` Memory used by shmem and tmpfs, allocated with huge pages - `MemoryShmemPmdMappedBytes float64` Shared memory mapped into user space with huge pages - `MemorySlabBytes float64` In-kernel data structures cache - `MemorySwapCachedBytes float64` Memory swapped out and back in while still in swap file - `MemorySwapFreeBytes float64` Amount of swap space that is currently unused - `MemorySwapTotalBytes float64` Total amount of swap space available - `MemoryTotalBytes float64` Total usable RAM - `MemoryVmallocChunkBytes float64` Largest contiguous block of vmalloc area which is free - `MemoryVmallocTotalBytes float64` Total size of vmalloc memory area - `MemoryVmallocUsedBytes float64` Amount of vmalloc area which is used - `MemoryWritebackBytes float64` Memory which is actively being written back to the disk - `MemoryWritebackTmpBytes float64` Memory used by FUSE for temporary writeback buffers - `MemoryZSwapBytes float64` Memory consumed by the zswap backend, compressed - `MemoryZSwappedBytes float64` Amount of anonymous memory stored in zswap, uncompressed - `Mounts []ConnectorSnapshotLatestListResponseItemsMount` - `FileSystem string` File system on disk (EXT4, NTFS, etc.) - `Kind string` Kind of disk (HDD, SSD, etc.) - `MountPoint string` Path where disk is mounted - `Name string` Name of the disk mount - `AvailableBytes float64` Available disk size (bytes) - `IsReadOnly bool` Determines whether the disk is read-only - `IsRemovable bool` Determines whether the disk is removable - `TotalBytes float64` Total disk size (bytes) - `Netdevs []ConnectorSnapshotLatestListResponseItemsNetdev` - `Name string` Name of the network device - `RecvBytes float64` Total bytes received - `RecvCompressed float64` Compressed packets received - `RecvDrop float64` Packets dropped - `RecvErrs float64` Bad packets received - `RecvFifo float64` FIFO overruns - `RecvFrame float64` Frame alignment errors - `RecvMulticast float64` Multicast packets received - `RecvPackets float64` Total packets received - `SentBytes float64` Total bytes transmitted - `SentCarrier float64` Number of packets not sent due to carrier errors - `SentColls float64` Number of collisions - `SentCompressed float64` Number of compressed packets transmitted - `SentDrop float64` Number of packets dropped during transmission - `SentErrs float64` Number of transmission errors - `SentFifo float64` FIFO overruns - `SentPackets float64` Total packets transmitted - `SnmpIcmpInAddrMaskReps float64` Number of ICMP Address Mask Reply messages received - `SnmpIcmpInAddrMasks float64` Number of ICMP Address Mask Request messages received - `SnmpIcmpInCsumErrors float64` Number of ICMP messages received with bad checksums - `SnmpIcmpInDestUnreachs float64` Number of ICMP Destination Unreachable messages received - `SnmpIcmpInEchoReps float64` Number of ICMP Echo Reply messages received - `SnmpIcmpInEchos float64` Number of ICMP Echo (request) messages received - `SnmpIcmpInErrors float64` Number of ICMP messages received with ICMP-specific errors - `SnmpIcmpInMsgs float64` Number of ICMP messages received - `SnmpIcmpInParmProbs float64` Number of ICMP Parameter Problem messages received - `SnmpIcmpInRedirects float64` Number of ICMP Redirect messages received - `SnmpIcmpInSrcQuenchs float64` Number of ICMP Source Quench messages received - `SnmpIcmpInTimeExcds float64` Number of ICMP Time Exceeded messages received - `SnmpIcmpInTimestampReps float64` Number of ICMP Address Mask Request messages received - `SnmpIcmpInTimestamps float64` Number of ICMP Timestamp (request) messages received - `SnmpIcmpOutAddrMaskReps float64` Number of ICMP Address Mask Reply messages sent - `SnmpIcmpOutAddrMasks float64` Number of ICMP Address Mask Request messages sent - `SnmpIcmpOutDestUnreachs float64` Number of ICMP Destination Unreachable messages sent - `SnmpIcmpOutEchoReps float64` Number of ICMP Echo Reply messages sent - `SnmpIcmpOutEchos float64` Number of ICMP Echo (request) messages sent - `SnmpIcmpOutErrors float64` Number of ICMP messages which this entity did not send due to ICMP-specific errors - `SnmpIcmpOutMsgs float64` Number of ICMP messages attempted to send - `SnmpIcmpOutParmProbs float64` Number of ICMP Parameter Problem messages sent - `SnmpIcmpOutRedirects float64` Number of ICMP Redirect messages sent - `SnmpIcmpOutSrcQuenchs float64` Number of ICMP Source Quench messages sent - `SnmpIcmpOutTimeExcds float64` Number of ICMP Time Exceeded messages sent - `SnmpIcmpOutTimestampReps float64` Number of ICMP Timestamp Reply messages sent - `SnmpIcmpOutTimestamps float64` Number of ICMP Timestamp (request) messages sent - `SnmpIPDefaultTTL float64` Default value of the Time-To-Live field of the IP header - `SnmpIPForwDatagrams float64` Number of datagrams forwarded to their final destination - `SnmpIPForwardingEnabled bool` Set when acting as an IP gateway - `SnmpIPFragCreates float64` Number of datagrams generated by fragmentation - `SnmpIPFragFails float64` Number of datagrams discarded because fragmentation failed - `SnmpIPFragOks float64` Number of datagrams successfully fragmented - `SnmpIPInAddrErrors float64` Number of input datagrams discarded due to errors in the IP address - `SnmpIPInDelivers float64` Number of input datagrams successfully delivered to IP user-protocols - `SnmpIPInDiscards float64` Number of input datagrams otherwise discarded - `SnmpIPInHdrErrors float64` Number of input datagrams discarded due to errors in the IP header - `SnmpIPInReceives float64` Number of input datagrams received from interfaces - `SnmpIPInUnknownProtos float64` Number of input datagrams discarded due unknown or unsupported protocol - `SnmpIPOutDiscards float64` Number of output datagrams otherwise discarded - `SnmpIPOutNoRoutes float64` Number of output datagrams discarded because no route matched - `SnmpIPOutRequests float64` Number of datagrams supplied for transmission - `SnmpIPReasmFails float64` Number of failures detected by the reassembly algorithm - `SnmpIPReasmOks float64` Number of datagrams successfully reassembled - `SnmpIPReasmReqds float64` Number of fragments received which needed to be reassembled - `SnmpIPReasmTimeout float64` Number of seconds fragments are held while awaiting reassembly - `SnmpTCPActiveOpens float64` Number of times TCP transitions to SYN-SENT from CLOSED - `SnmpTCPAttemptFails float64` Number of times TCP transitions to CLOSED from SYN-SENT or SYN-RCVD, plus transitions to LISTEN from SYN-RCVD - `SnmpTCPCurrEstab float64` Number of TCP connections in ESTABLISHED or CLOSE-WAIT - `SnmpTCPEstabResets float64` Number of times TCP transitions to CLOSED from ESTABLISHED or CLOSE-WAIT - `SnmpTCPInCsumErrors float64` Number of TCP segments received with checksum errors - `SnmpTCPInErrs float64` Number of TCP segments received in error - `SnmpTCPInSegs float64` Number of TCP segments received - `SnmpTCPMaxConn float64` Limit on the total number of TCP connections - `SnmpTCPOutRsts float64` Number of TCP segments sent with RST flag - `SnmpTCPOutSegs float64` Number of TCP segments sent - `SnmpTCPPassiveOpens float64` Number of times TCP transitions to SYN-RCVD from LISTEN - `SnmpTCPRetransSegs float64` Number of TCP segments retransmitted - `SnmpTCPRtoMax float64` Maximum value permitted by a TCP implementation for the retransmission timeout (milliseconds) - `SnmpTCPRtoMin float64` Minimum value permitted by a TCP implementation for the retransmission timeout (milliseconds) - `SnmpUdpInDatagrams float64` Number of UDP datagrams delivered to UDP applications - `SnmpUdpInErrors float64` Number of UDP datagrams failed to be delivered for reasons other than lack of application at the destination port - `SnmpUdpNoPorts float64` Number of UDP datagrams received for which there was not application at the destination port - `SnmpUdpOutDatagrams float64` Number of UDP datagrams sent - `SystemBootTimeS float64` Boottime of the system (seconds since the Unix epoch) - `Thermals []ConnectorSnapshotLatestListResponseItemsThermal` - `Label string` Sensor identifier for the component - `CriticalCelcius float64` Critical failure temperature of the component (degrees Celsius) - `CurrentCelcius float64` Current temperature of the component (degrees Celsius) - `MaxCelcius float64` Maximum temperature of the component (degrees Celsius) - `Tunnels []ConnectorSnapshotLatestListResponseItemsTunnel` - `HealthState string` Name of tunnel health state (unknown, healthy, degraded, down) - `HealthValue float64` Numeric value associated with tunnel state (0 = unknown, 1 = healthy, 2 = degraded, 3 = down) - `InterfaceName string` The tunnel interface name (i.e. xfrm1, xfrm3.99, etc.) - `TunnelID string` Tunnel identifier - `ProbedMtu float64` MTU as measured between the two ends of the tunnel - `RecentHealthyPings float64` Number of recent healthy pings for this tunnel - `RecentUnhealthyPings float64` Number of recent unhealthy pings for this tunnel - `UptimeIdleMs float64` Sum of how much time each core has spent idle - `UptimeTotalMs float64` Uptime of the system, including time spent in suspend ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) latests, err := client.MagicTransit.Connectors.Snapshots.Latest.List( context.TODO(), "connector_id", magic_transit.ConnectorSnapshotLatestListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", latests.Count) } ``` #### Response ```json { "result": { "count": 0, "items": [ { "count_reclaim_failures": 0, "count_reclaimed_paths": 0, "count_record_failed": 0, "count_transmit_failures": 0, "t": 0, "v": "v", "bonds": [ { "name": "name", "status": "status" } ], "cpu_count": 0, "cpu_pressure_10s": 0, "cpu_pressure_300s": 0, "cpu_pressure_60s": 0, "cpu_pressure_total_us": 0, "cpu_time_guest_ms": 0, "cpu_time_guest_nice_ms": 0, "cpu_time_idle_ms": 0, "cpu_time_iowait_ms": 0, "cpu_time_irq_ms": 0, "cpu_time_nice_ms": 0, "cpu_time_softirq_ms": 0, "cpu_time_steal_ms": 0, "cpu_time_system_ms": 0, "cpu_time_user_ms": 0, "delta": 0, "dhcp_leases": [ { "client_id": "client_id", "expiry_time": 0, "hostname": "hostname", "interface_name": "interface_name", "ip_address": "ip_address", "mac_address": "mac_address" } ], "disks": [ { "in_progress": 0, "major": 0, "merged": 0, "minor": 0, "name": "name", "reads": 0, "sectors_read": 0, "sectors_written": 0, "time_in_progress_ms": 0, "time_reading_ms": 0, "time_writing_ms": 0, "weighted_time_in_progress_ms": 0, "writes": 0, "writes_merged": 0, "discards": 0, "discards_merged": 0, "flushes": 0, "sectors_discarded": 0, "time_discarding_ms": 0, "time_flushing_ms": 0 } ], "epsilon": 0, "ha_state": "ha_state", "ha_value": 0, "interfaces": [ { "name": "name", "operstate": "operstate", "ip_addresses": [ { "interface_name": "interface_name", "ip_address": "ip_address" } ], "speed": 0 } ], "io_pressure_full_10s": 0, "io_pressure_full_300s": 0, "io_pressure_full_60s": 0, "io_pressure_full_total_us": 0, "io_pressure_some_10s": 0, "io_pressure_some_300s": 0, "io_pressure_some_60s": 0, "io_pressure_some_total_us": 0, "kernel_btime": 0, "kernel_ctxt": 0, "kernel_processes": 0, "kernel_processes_blocked": 0, "kernel_processes_running": 0, "load_average_15m": 0, "load_average_1m": 0, "load_average_5m": 0, "load_average_cur": 0, "load_average_max": 0, "memory_active_bytes": 0, "memory_anon_hugepages_bytes": 0, "memory_anon_pages_bytes": 0, "memory_available_bytes": 0, "memory_bounce_bytes": 0, "memory_buffers_bytes": 0, "memory_cached_bytes": 0, "memory_cma_free_bytes": 0, "memory_cma_total_bytes": 0, "memory_commit_limit_bytes": 0, "memory_committed_as_bytes": 0, "memory_dirty_bytes": 0, "memory_free_bytes": 0, "memory_high_free_bytes": 0, "memory_high_total_bytes": 0, "memory_hugepages_free": 0, "memory_hugepages_rsvd": 0, "memory_hugepages_surp": 0, "memory_hugepages_total": 0, "memory_hugepagesize_bytes": 0, "memory_inactive_bytes": 0, "memory_k_reclaimable_bytes": 0, "memory_kernel_stack_bytes": 0, "memory_low_free_bytes": 0, "memory_low_total_bytes": 0, "memory_mapped_bytes": 0, "memory_page_tables_bytes": 0, "memory_per_cpu_bytes": 0, "memory_pressure_full_10s": 0, "memory_pressure_full_300s": 0, "memory_pressure_full_60s": 0, "memory_pressure_full_total_us": 0, "memory_pressure_some_10s": 0, "memory_pressure_some_300s": 0, "memory_pressure_some_60s": 0, "memory_pressure_some_total_us": 0, "memory_s_reclaimable_bytes": 0, "memory_s_unreclaim_bytes": 0, "memory_secondary_page_tables_bytes": 0, "memory_shmem_bytes": 0, "memory_shmem_hugepages_bytes": 0, "memory_shmem_pmd_mapped_bytes": 0, "memory_slab_bytes": 0, "memory_swap_cached_bytes": 0, "memory_swap_free_bytes": 0, "memory_swap_total_bytes": 0, "memory_total_bytes": 0, "memory_vmalloc_chunk_bytes": 0, "memory_vmalloc_total_bytes": 0, "memory_vmalloc_used_bytes": 0, "memory_writeback_bytes": 0, "memory_writeback_tmp_bytes": 0, "memory_z_swap_bytes": 0, "memory_z_swapped_bytes": 0, "mounts": [ { "file_system": "file_system", "kind": "kind", "mount_point": "mount_point", "name": "name", "available_bytes": 0, "is_read_only": true, "is_removable": true, "total_bytes": 0 } ], "netdevs": [ { "name": "name", "recv_bytes": 0, "recv_compressed": 0, "recv_drop": 0, "recv_errs": 0, "recv_fifo": 0, "recv_frame": 0, "recv_multicast": 0, "recv_packets": 0, "sent_bytes": 0, "sent_carrier": 0, "sent_colls": 0, "sent_compressed": 0, "sent_drop": 0, "sent_errs": 0, "sent_fifo": 0, "sent_packets": 0 } ], "snmp_icmp_in_addr_mask_reps": 0, "snmp_icmp_in_addr_masks": 0, "snmp_icmp_in_csum_errors": 0, "snmp_icmp_in_dest_unreachs": 0, "snmp_icmp_in_echo_reps": 0, "snmp_icmp_in_echos": 0, "snmp_icmp_in_errors": 0, "snmp_icmp_in_msgs": 0, "snmp_icmp_in_parm_probs": 0, "snmp_icmp_in_redirects": 0, "snmp_icmp_in_src_quenchs": 0, "snmp_icmp_in_time_excds": 0, "snmp_icmp_in_timestamp_reps": 0, "snmp_icmp_in_timestamps": 0, "snmp_icmp_out_addr_mask_reps": 0, "snmp_icmp_out_addr_masks": 0, "snmp_icmp_out_dest_unreachs": 0, "snmp_icmp_out_echo_reps": 0, "snmp_icmp_out_echos": 0, "snmp_icmp_out_errors": 0, "snmp_icmp_out_msgs": 0, "snmp_icmp_out_parm_probs": 0, "snmp_icmp_out_redirects": 0, "snmp_icmp_out_src_quenchs": 0, "snmp_icmp_out_time_excds": 0, "snmp_icmp_out_timestamp_reps": 0, "snmp_icmp_out_timestamps": 0, "snmp_ip_default_ttl": 0, "snmp_ip_forw_datagrams": 0, "snmp_ip_forwarding_enabled": true, "snmp_ip_frag_creates": 0, "snmp_ip_frag_fails": 0, "snmp_ip_frag_oks": 0, "snmp_ip_in_addr_errors": 0, "snmp_ip_in_delivers": 0, "snmp_ip_in_discards": 0, "snmp_ip_in_hdr_errors": 0, "snmp_ip_in_receives": 0, "snmp_ip_in_unknown_protos": 0, "snmp_ip_out_discards": 0, "snmp_ip_out_no_routes": 0, "snmp_ip_out_requests": 0, "snmp_ip_reasm_fails": 0, "snmp_ip_reasm_oks": 0, "snmp_ip_reasm_reqds": 0, "snmp_ip_reasm_timeout": 0, "snmp_tcp_active_opens": 0, "snmp_tcp_attempt_fails": 0, "snmp_tcp_curr_estab": 0, "snmp_tcp_estab_resets": 0, "snmp_tcp_in_csum_errors": 0, "snmp_tcp_in_errs": 0, "snmp_tcp_in_segs": 0, "snmp_tcp_max_conn": 0, "snmp_tcp_out_rsts": 0, "snmp_tcp_out_segs": 0, "snmp_tcp_passive_opens": 0, "snmp_tcp_retrans_segs": 0, "snmp_tcp_rto_max": 0, "snmp_tcp_rto_min": 0, "snmp_udp_in_datagrams": 0, "snmp_udp_in_errors": 0, "snmp_udp_no_ports": 0, "snmp_udp_out_datagrams": 0, "system_boot_time_s": 0, "thermals": [ { "label": "label", "critical_celcius": 0, "current_celcius": 0, "max_celcius": 0 } ], "tunnels": [ { "health_state": "health_state", "health_value": 0, "interface_name": "interface_name", "tunnel_id": "tunnel_id", "probed_mtu": 0, "recent_healthy_pings": 0, "recent_unhealthy_pings": 0 } ], "uptime_idle_ms": 0, "uptime_total_ms": 0 } ] }, "success": true, "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ] } ``` # PCAPs ## List packet capture requests `client.MagicTransit.PCAPs.List(ctx, query) (*SinglePage[PCAPListResponse], error)` **get** `/accounts/{account_id}/pcaps` Lists all packet capture requests for an account. ### Parameters - `query PCAPListParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type PCAPListResponse interface{…}` - `type PCAP struct{…}` - `ID string` The ID for the packet capture. - `FilterV1 PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `DestinationAddress string` The destination IP address of the packet. - `DestinationPort float64` The destination port of the packet. - `Protocol float64` The protocol number of the packet. - `SourceAddress string` The source IP address of the packet. - `SourcePort float64` The source port of the packet. - `OffsetTime Time` The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. - `Status PCAPStatus` The status of the packet capture request. - `const PCAPStatusUnknown PCAPStatus = "unknown"` - `const PCAPStatusSuccess PCAPStatus = "success"` - `const PCAPStatusPending PCAPStatus = "pending"` - `const PCAPStatusRunning PCAPStatus = "running"` - `const PCAPStatusConversionPending PCAPStatus = "conversion_pending"` - `const PCAPStatusConversionRunning PCAPStatus = "conversion_running"` - `const PCAPStatusComplete PCAPStatus = "complete"` - `const PCAPStatusFailed PCAPStatus = "failed"` - `Submitted string` The RFC 3339 timestamp when the packet capture was created. - `System PCAPSystem` The system used to collect packet captures. - `const PCAPSystemMagicTransit PCAPSystem = "magic-transit"` - `TimeLimit float64` The packet capture duration in seconds. - `Type PCAPType` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `const PCAPTypeSimple PCAPType = "simple"` - `const PCAPTypeFull PCAPType = "full"` - `type PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFull struct{…}` - `ID string` The ID for the packet capture. - `ByteLimit float64` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `ColoName string` The name of the data center used for the packet capture. This can be a specific colo (ord02) or a multi-colo name (ORD). This field only applies to `full` packet captures. - `DestinationConf string` The full URI for the bucket. This field only applies to `full` packet captures. - `ErrorMessage string` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `FilterV1 PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `PacketsCaptured int64` The number of packets captured. - `Status PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus` The status of the packet capture request. - `const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusUnknown PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "unknown"` - `const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusSuccess PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "success"` - `const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusPending PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "pending"` - `const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusRunning PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "running"` - `const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusConversionPending PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "conversion_pending"` - `const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusConversionRunning PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "conversion_running"` - `const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusComplete PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "complete"` - `const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusFailed PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "failed"` - `StopRequested Time` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `Submitted string` The RFC 3339 timestamp when the packet capture was created. - `System PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullSystem` The system used to collect packet captures. - `const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullSystemMagicTransit PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullSystem = "magic-transit"` - `TimeLimit float64` The packet capture duration in seconds. - `Type PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullType` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullTypeSimple PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullType = "simple"` - `const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullTypeFull PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullType = "full"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.MagicTransit.PCAPs.List(context.TODO(), magic_transit.PCAPListParams{ AccountID: 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": [ { "id": "66802ca5668e47a2b82c2e6746e45037", "filter_v1": { "destination_address": "1.2.3.4", "destination_port": 80, "protocol": 6, "source_address": "1.2.3.4", "source_port": 123 }, "offset_time": "2020-01-01T08:00:00Z", "status": "success", "submitted": "2020-01-01T08:00:00Z", "system": "magic-transit", "time_limit": 300, "type": "simple" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get PCAP request `client.MagicTransit.PCAPs.Get(ctx, pcapID, query) (*PCAPGetResponse, error)` **get** `/accounts/{account_id}/pcaps/{pcap_id}` Get information for a PCAP request by id. ### Parameters - `pcapID string` Identifier. - `query PCAPGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type PCAPGetResponse interface{…}` - `type PCAP struct{…}` - `ID string` The ID for the packet capture. - `FilterV1 PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `DestinationAddress string` The destination IP address of the packet. - `DestinationPort float64` The destination port of the packet. - `Protocol float64` The protocol number of the packet. - `SourceAddress string` The source IP address of the packet. - `SourcePort float64` The source port of the packet. - `OffsetTime Time` The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. - `Status PCAPStatus` The status of the packet capture request. - `const PCAPStatusUnknown PCAPStatus = "unknown"` - `const PCAPStatusSuccess PCAPStatus = "success"` - `const PCAPStatusPending PCAPStatus = "pending"` - `const PCAPStatusRunning PCAPStatus = "running"` - `const PCAPStatusConversionPending PCAPStatus = "conversion_pending"` - `const PCAPStatusConversionRunning PCAPStatus = "conversion_running"` - `const PCAPStatusComplete PCAPStatus = "complete"` - `const PCAPStatusFailed PCAPStatus = "failed"` - `Submitted string` The RFC 3339 timestamp when the packet capture was created. - `System PCAPSystem` The system used to collect packet captures. - `const PCAPSystemMagicTransit PCAPSystem = "magic-transit"` - `TimeLimit float64` The packet capture duration in seconds. - `Type PCAPType` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `const PCAPTypeSimple PCAPType = "simple"` - `const PCAPTypeFull PCAPType = "full"` - `type PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFull struct{…}` - `ID string` The ID for the packet capture. - `ByteLimit float64` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `ColoName string` The name of the data center used for the packet capture. This can be a specific colo (ord02) or a multi-colo name (ORD). This field only applies to `full` packet captures. - `DestinationConf string` The full URI for the bucket. This field only applies to `full` packet captures. - `ErrorMessage string` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `FilterV1 PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `PacketsCaptured int64` The number of packets captured. - `Status PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatus` The status of the packet capture request. - `const PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatusUnknown PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "unknown"` - `const PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatusSuccess PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "success"` - `const PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatusPending PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "pending"` - `const PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatusRunning PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "running"` - `const PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatusConversionPending PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "conversion_pending"` - `const PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatusConversionRunning PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "conversion_running"` - `const PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatusComplete PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "complete"` - `const PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatusFailed PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "failed"` - `StopRequested Time` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `Submitted string` The RFC 3339 timestamp when the packet capture was created. - `System PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullSystem` The system used to collect packet captures. - `const PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullSystemMagicTransit PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullSystem = "magic-transit"` - `TimeLimit float64` The packet capture duration in seconds. - `Type PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullType` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `const PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullTypeSimple PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullType = "simple"` - `const PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullTypeFull PCAPGetResponseMagicVisibilityPCAPsPCAPsResponseFullType = "full"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) pcap, err := client.MagicTransit.PCAPs.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.PCAPGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", pcap) } ``` #### 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": { "id": "66802ca5668e47a2b82c2e6746e45037", "filter_v1": { "destination_address": "1.2.3.4", "destination_port": 80, "protocol": 6, "source_address": "1.2.3.4", "source_port": 123 }, "offset_time": "2020-01-01T08:00:00Z", "status": "success", "submitted": "2020-01-01T08:00:00Z", "system": "magic-transit", "time_limit": 300, "type": "simple" }, "success": true } ``` ## Create PCAP request `client.MagicTransit.PCAPs.New(ctx, params) (*PCAPNewResponse, error)` **post** `/accounts/{account_id}/pcaps` Create new PCAP request for account. ### Parameters - `params PCAPNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `PacketLimit param.Field[float64]` Body param: The limit of packets contained in a packet capture. - `System param.Field[PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleSystem]` Body param: The system used to collect packet captures. - `const PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleSystemMagicTransit PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleSystem = "magic-transit"` - `TimeLimit param.Field[float64]` Body param: The packet capture duration in seconds. - `Type param.Field[PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleType]` Body param: The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `const PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleTypeSimple PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleType = "simple"` - `const PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleTypeFull PCAPNewParamsMagicVisibilityPCAPsPCAPsRequestSimpleType = "full"` - `FilterV1 param.Field[PCAPFilter]` Body param: The packet capture filter. When this field is empty, all packets are captured. - `OffsetTime param.Field[Time]` Body param: The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. ### Returns - `type PCAPNewResponse interface{…}` - `type PCAP struct{…}` - `ID string` The ID for the packet capture. - `FilterV1 PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `DestinationAddress string` The destination IP address of the packet. - `DestinationPort float64` The destination port of the packet. - `Protocol float64` The protocol number of the packet. - `SourceAddress string` The source IP address of the packet. - `SourcePort float64` The source port of the packet. - `OffsetTime Time` The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. - `Status PCAPStatus` The status of the packet capture request. - `const PCAPStatusUnknown PCAPStatus = "unknown"` - `const PCAPStatusSuccess PCAPStatus = "success"` - `const PCAPStatusPending PCAPStatus = "pending"` - `const PCAPStatusRunning PCAPStatus = "running"` - `const PCAPStatusConversionPending PCAPStatus = "conversion_pending"` - `const PCAPStatusConversionRunning PCAPStatus = "conversion_running"` - `const PCAPStatusComplete PCAPStatus = "complete"` - `const PCAPStatusFailed PCAPStatus = "failed"` - `Submitted string` The RFC 3339 timestamp when the packet capture was created. - `System PCAPSystem` The system used to collect packet captures. - `const PCAPSystemMagicTransit PCAPSystem = "magic-transit"` - `TimeLimit float64` The packet capture duration in seconds. - `Type PCAPType` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `const PCAPTypeSimple PCAPType = "simple"` - `const PCAPTypeFull PCAPType = "full"` - `type PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFull struct{…}` - `ID string` The ID for the packet capture. - `ByteLimit float64` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `ColoName string` The name of the data center used for the packet capture. This can be a specific colo (ord02) or a multi-colo name (ORD). This field only applies to `full` packet captures. - `DestinationConf string` The full URI for the bucket. This field only applies to `full` packet captures. - `ErrorMessage string` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `FilterV1 PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `PacketsCaptured int64` The number of packets captured. - `Status PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus` The status of the packet capture request. - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusUnknown PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "unknown"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusSuccess PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "success"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusPending PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "pending"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusRunning PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "running"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusConversionPending PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "conversion_pending"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusConversionRunning PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "conversion_running"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusComplete PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "complete"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatusFailed PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "failed"` - `StopRequested Time` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `Submitted string` The RFC 3339 timestamp when the packet capture was created. - `System PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullSystem` The system used to collect packet captures. - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullSystemMagicTransit PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullSystem = "magic-transit"` - `TimeLimit float64` The packet capture duration in seconds. - `Type PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullType` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullTypeSimple PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullType = "simple"` - `const PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullTypeFull PCAPNewResponseMagicVisibilityPCAPsPCAPsResponseFullType = "full"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) pcap, err := client.MagicTransit.PCAPs.New(context.TODO(), magic_transit.PCAPNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: magic_transit.PCAPNewParamsBodyMagicVisibilityPCAPsPCAPsRequestSimple{ PacketLimit: cloudflare.F(10000.000000), System: cloudflare.F(magic_transit.PCAPNewParamsBodyMagicVisibilityPCAPsPCAPsRequestSimpleSystemMagicTransit), TimeLimit: cloudflare.F(300.000000), Type: cloudflare.F(magic_transit.PCAPNewParamsBodyMagicVisibilityPCAPsPCAPsRequestSimpleTypeSimple), }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", pcap) } ``` #### 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": { "id": "66802ca5668e47a2b82c2e6746e45037", "filter_v1": { "destination_address": "1.2.3.4", "destination_port": 80, "protocol": 6, "source_address": "1.2.3.4", "source_port": 123 }, "offset_time": "2020-01-01T08:00:00Z", "status": "success", "submitted": "2020-01-01T08:00:00Z", "system": "magic-transit", "time_limit": 300, "type": "simple" }, "success": true } ``` ## Stop full PCAP `client.MagicTransit.PCAPs.Stop(ctx, pcapID, body) error` **put** `/accounts/{account_id}/pcaps/{pcap_id}/stop` Stop full PCAP. ### Parameters - `pcapID string` Identifier. - `body PCAPStopParams` - `AccountID param.Field[string]` Identifier. ### Example ```go package main import ( "context" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) err := client.MagicTransit.PCAPs.Stop( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.PCAPStopParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } } ``` ## Domain Types ### PCAP - `type PCAP struct{…}` - `ID string` The ID for the packet capture. - `FilterV1 PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `DestinationAddress string` The destination IP address of the packet. - `DestinationPort float64` The destination port of the packet. - `Protocol float64` The protocol number of the packet. - `SourceAddress string` The source IP address of the packet. - `SourcePort float64` The source port of the packet. - `OffsetTime Time` The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. - `Status PCAPStatus` The status of the packet capture request. - `const PCAPStatusUnknown PCAPStatus = "unknown"` - `const PCAPStatusSuccess PCAPStatus = "success"` - `const PCAPStatusPending PCAPStatus = "pending"` - `const PCAPStatusRunning PCAPStatus = "running"` - `const PCAPStatusConversionPending PCAPStatus = "conversion_pending"` - `const PCAPStatusConversionRunning PCAPStatus = "conversion_running"` - `const PCAPStatusComplete PCAPStatus = "complete"` - `const PCAPStatusFailed PCAPStatus = "failed"` - `Submitted string` The RFC 3339 timestamp when the packet capture was created. - `System PCAPSystem` The system used to collect packet captures. - `const PCAPSystemMagicTransit PCAPSystem = "magic-transit"` - `TimeLimit float64` The packet capture duration in seconds. - `Type PCAPType` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `const PCAPTypeSimple PCAPType = "simple"` - `const PCAPTypeFull PCAPType = "full"` ### PCAP Filter - `type PCAPFilter struct{…}` The packet capture filter. When this field is empty, all packets are captured. - `DestinationAddress string` The destination IP address of the packet. - `DestinationPort float64` The destination port of the packet. - `Protocol float64` The protocol number of the packet. - `SourceAddress string` The source IP address of the packet. - `SourcePort float64` The source port of the packet. # Ownership ## List PCAPs Bucket Ownership `client.MagicTransit.PCAPs.Ownership.Get(ctx, query) (*SinglePage[Ownership], error)` **get** `/accounts/{account_id}/pcaps/ownership` List all buckets configured for use with PCAPs API. ### Parameters - `query PCAPOwnershipGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type Ownership struct{…}` - `ID string` The bucket ID associated with the packet captures API. - `DestinationConf string` The full URI for the bucket. This field only applies to `full` packet captures. - `Filename string` The ownership challenge filename stored in the bucket. - `Status OwnershipStatus` The status of the ownership challenge. Can be pending, success or failed. - `const OwnershipStatusPending OwnershipStatus = "pending"` - `const OwnershipStatusSuccess OwnershipStatus = "success"` - `const OwnershipStatusFailed OwnershipStatus = "failed"` - `Submitted string` The RFC 3339 timestamp when the bucket was added to packet captures API. - `Validated string` The RFC 3339 timestamp when the bucket was validated. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.MagicTransit.PCAPs.Ownership.Get(context.TODO(), magic_transit.PCAPOwnershipGetParams{ AccountID: 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": [ { "id": "9883874ecac311ec8475433579a6bf5f", "destination_conf": "s3://pcaps-bucket?region=us-east-1", "filename": "ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", "status": "success", "submitted": "2020-01-01T08:00:00Z", "validated": "2020-01-01T08:00:00Z" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Add buckets for full packet captures `client.MagicTransit.PCAPs.Ownership.New(ctx, params) (*Ownership, error)` **post** `/accounts/{account_id}/pcaps/ownership` Adds an AWS or GCP bucket to use with full packet captures. ### Parameters - `params PCAPOwnershipNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `DestinationConf param.Field[string]` Body param: The full URI for the bucket. This field only applies to `full` packet captures. ### Returns - `type Ownership struct{…}` - `ID string` The bucket ID associated with the packet captures API. - `DestinationConf string` The full URI for the bucket. This field only applies to `full` packet captures. - `Filename string` The ownership challenge filename stored in the bucket. - `Status OwnershipStatus` The status of the ownership challenge. Can be pending, success or failed. - `const OwnershipStatusPending OwnershipStatus = "pending"` - `const OwnershipStatusSuccess OwnershipStatus = "success"` - `const OwnershipStatusFailed OwnershipStatus = "failed"` - `Submitted string` The RFC 3339 timestamp when the bucket was added to packet captures API. - `Validated string` The RFC 3339 timestamp when the bucket was validated. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) ownership, err := client.MagicTransit.PCAPs.Ownership.New(context.TODO(), magic_transit.PCAPOwnershipNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), DestinationConf: cloudflare.F("s3://pcaps-bucket?region=us-east-1"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", ownership.ID) } ``` #### 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": { "id": "9883874ecac311ec8475433579a6bf5f", "destination_conf": "s3://pcaps-bucket?region=us-east-1", "filename": "ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", "status": "success", "submitted": "2020-01-01T08:00:00Z", "validated": "2020-01-01T08:00:00Z" }, "success": true } ``` ## Delete buckets for full packet captures `client.MagicTransit.PCAPs.Ownership.Delete(ctx, ownershipID, body) error` **delete** `/accounts/{account_id}/pcaps/ownership/{ownership_id}` Deletes buckets added to the packet captures API. ### Parameters - `ownershipID string` Identifier. - `body PCAPOwnershipDeleteParams` - `AccountID param.Field[string]` Identifier. ### Example ```go package main import ( "context" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) err := client.MagicTransit.PCAPs.Ownership.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.PCAPOwnershipDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } } ``` ## Validate buckets for full packet captures `client.MagicTransit.PCAPs.Ownership.Validate(ctx, params) (*Ownership, error)` **post** `/accounts/{account_id}/pcaps/ownership/validate` Validates buckets added to the packet captures API. ### Parameters - `params PCAPOwnershipValidateParams` - `AccountID param.Field[string]` Path param: Identifier. - `DestinationConf param.Field[string]` Body param: The full URI for the bucket. This field only applies to `full` packet captures. - `OwnershipChallenge param.Field[string]` Body param: The ownership challenge filename stored in the bucket. ### Returns - `type Ownership struct{…}` - `ID string` The bucket ID associated with the packet captures API. - `DestinationConf string` The full URI for the bucket. This field only applies to `full` packet captures. - `Filename string` The ownership challenge filename stored in the bucket. - `Status OwnershipStatus` The status of the ownership challenge. Can be pending, success or failed. - `const OwnershipStatusPending OwnershipStatus = "pending"` - `const OwnershipStatusSuccess OwnershipStatus = "success"` - `const OwnershipStatusFailed OwnershipStatus = "failed"` - `Submitted string` The RFC 3339 timestamp when the bucket was added to packet captures API. - `Validated string` The RFC 3339 timestamp when the bucket was validated. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) ownership, err := client.MagicTransit.PCAPs.Ownership.Validate(context.TODO(), magic_transit.PCAPOwnershipValidateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), DestinationConf: cloudflare.F("s3://pcaps-bucket?region=us-east-1"), OwnershipChallenge: cloudflare.F("ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", ownership.ID) } ``` #### 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": { "id": "9883874ecac311ec8475433579a6bf5f", "destination_conf": "s3://pcaps-bucket?region=us-east-1", "filename": "ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", "status": "success", "submitted": "2020-01-01T08:00:00Z", "validated": "2020-01-01T08:00:00Z" }, "success": true } ``` ## Domain Types ### Ownership - `type Ownership struct{…}` - `ID string` The bucket ID associated with the packet captures API. - `DestinationConf string` The full URI for the bucket. This field only applies to `full` packet captures. - `Filename string` The ownership challenge filename stored in the bucket. - `Status OwnershipStatus` The status of the ownership challenge. Can be pending, success or failed. - `const OwnershipStatusPending OwnershipStatus = "pending"` - `const OwnershipStatusSuccess OwnershipStatus = "success"` - `const OwnershipStatusFailed OwnershipStatus = "failed"` - `Submitted string` The RFC 3339 timestamp when the bucket was added to packet captures API. - `Validated string` The RFC 3339 timestamp when the bucket was validated. # Download ## Download Simple PCAP `client.MagicTransit.PCAPs.Download.Get(ctx, pcapID, query) (*Response, error)` **get** `/accounts/{account_id}/pcaps/{pcap_id}/download` Download PCAP information into a file. Response is a binary PCAP file. ### Parameters - `pcapID string` Identifier. - `query PCAPDownloadGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type PCAPDownloadGetResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) download, err := client.MagicTransit.PCAPs.Download.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.PCAPDownloadGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", download) } ```