# Sites ## List Sites `magic_transit.sites.list(SiteListParams**kwargs) -> SyncSinglePage[Site]` **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 - `account_id: str` Identifier - `connectorid: Optional[str]` Identifier ### Returns - `class Site: …` - `id: Optional[str]` Identifier - `connector_id: Optional[str]` Magic Connector identifier tag. - `description: Optional[str]` - `ha_mode: Optional[bool]` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `location: Optional[SiteLocation]` Location of site in latitude and longitude. - `lat: Optional[str]` Latitude - `lon: Optional[str]` Longitude - `name: Optional[str]` The name of the site. - `secondary_connector_id: Optional[str]` Magic Connector identifier tag. Used when high availability mode is on. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.magic_transit.sites.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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 } ``` ## Site Details `magic_transit.sites.get(strsite_id, SiteGetParams**kwargs) -> Site` **get** `/accounts/{account_id}/magic/sites/{site_id}` Get a specific Site. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `x_magic_new_hc_target: Optional[bool]` ### Returns - `class Site: …` - `id: Optional[str]` Identifier - `connector_id: Optional[str]` Magic Connector identifier tag. - `description: Optional[str]` - `ha_mode: Optional[bool]` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `location: Optional[SiteLocation]` Location of site in latitude and longitude. - `lat: Optional[str]` Latitude - `lon: Optional[str]` Longitude - `name: Optional[str]` The name of the site. - `secondary_connector_id: Optional[str]` Magic Connector identifier tag. Used when high availability mode is on. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) site = client.magic_transit.sites.get( site_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `magic_transit.sites.create(SiteCreateParams**kwargs) -> Site` **post** `/accounts/{account_id}/magic/sites` Creates a new Site ### Parameters - `account_id: str` Identifier - `name: str` The name of the site. - `connector_id: Optional[str]` Magic Connector identifier tag. - `description: Optional[str]` - `ha_mode: Optional[bool]` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `location: Optional[SiteLocationParam]` Location of site in latitude and longitude. - `lat: Optional[str]` Latitude - `lon: Optional[str]` Longitude - `secondary_connector_id: Optional[str]` Magic Connector identifier tag. Used when high availability mode is on. ### Returns - `class Site: …` - `id: Optional[str]` Identifier - `connector_id: Optional[str]` Magic Connector identifier tag. - `description: Optional[str]` - `ha_mode: Optional[bool]` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `location: Optional[SiteLocation]` Location of site in latitude and longitude. - `lat: Optional[str]` Latitude - `lon: Optional[str]` Longitude - `name: Optional[str]` The name of the site. - `secondary_connector_id: Optional[str]` Magic Connector identifier tag. Used when high availability mode is on. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) site = client.magic_transit.sites.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", name="site_1", ) print(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 `magic_transit.sites.update(strsite_id, SiteUpdateParams**kwargs) -> Site` **put** `/accounts/{account_id}/magic/sites/{site_id}` Update a specific Site. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `connector_id: Optional[str]` Magic Connector identifier tag. - `description: Optional[str]` - `location: Optional[SiteLocationParam]` Location of site in latitude and longitude. - `lat: Optional[str]` Latitude - `lon: Optional[str]` Longitude - `name: Optional[str]` The name of the site. - `secondary_connector_id: Optional[str]` Magic Connector identifier tag. Used when high availability mode is on. ### Returns - `class Site: …` - `id: Optional[str]` Identifier - `connector_id: Optional[str]` Magic Connector identifier tag. - `description: Optional[str]` - `ha_mode: Optional[bool]` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `location: Optional[SiteLocation]` Location of site in latitude and longitude. - `lat: Optional[str]` Latitude - `lon: Optional[str]` Longitude - `name: Optional[str]` The name of the site. - `secondary_connector_id: Optional[str]` Magic Connector identifier tag. Used when high availability mode is on. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) site = client.magic_transit.sites.update( site_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `magic_transit.sites.edit(strsite_id, SiteEditParams**kwargs) -> Site` **patch** `/accounts/{account_id}/magic/sites/{site_id}` Patch a specific Site. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `connector_id: Optional[str]` Magic Connector identifier tag. - `description: Optional[str]` - `location: Optional[SiteLocationParam]` Location of site in latitude and longitude. - `lat: Optional[str]` Latitude - `lon: Optional[str]` Longitude - `name: Optional[str]` The name of the site. - `secondary_connector_id: Optional[str]` Magic Connector identifier tag. Used when high availability mode is on. ### Returns - `class Site: …` - `id: Optional[str]` Identifier - `connector_id: Optional[str]` Magic Connector identifier tag. - `description: Optional[str]` - `ha_mode: Optional[bool]` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `location: Optional[SiteLocation]` Location of site in latitude and longitude. - `lat: Optional[str]` Latitude - `lon: Optional[str]` Longitude - `name: Optional[str]` The name of the site. - `secondary_connector_id: Optional[str]` Magic Connector identifier tag. Used when high availability mode is on. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) site = client.magic_transit.sites.edit( site_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `magic_transit.sites.delete(strsite_id, SiteDeleteParams**kwargs) -> Site` **delete** `/accounts/{account_id}/magic/sites/{site_id}` Remove a specific Site. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier ### Returns - `class Site: …` - `id: Optional[str]` Identifier - `connector_id: Optional[str]` Magic Connector identifier tag. - `description: Optional[str]` - `ha_mode: Optional[bool]` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `location: Optional[SiteLocation]` Location of site in latitude and longitude. - `lat: Optional[str]` Latitude - `lon: Optional[str]` Longitude - `name: Optional[str]` The name of the site. - `secondary_connector_id: Optional[str]` Magic Connector identifier tag. Used when high availability mode is on. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) site = client.magic_transit.sites.delete( site_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 - `class Site: …` - `id: Optional[str]` Identifier - `connector_id: Optional[str]` Magic Connector identifier tag. - `description: Optional[str]` - `ha_mode: Optional[bool]` Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. - `location: Optional[SiteLocation]` Location of site in latitude and longitude. - `lat: Optional[str]` Latitude - `lon: Optional[str]` Longitude - `name: Optional[str]` The name of the site. - `secondary_connector_id: Optional[str]` Magic Connector identifier tag. Used when high availability mode is on. ### Site Location - `class SiteLocation: …` Location of site in latitude and longitude. - `lat: Optional[str]` Latitude - `lon: Optional[str]` Longitude # App Configuration # ACLs ## List Site ACLs `magic_transit.sites.acls.list(strsite_id, ACLListParams**kwargs) -> SyncSinglePage[ACL]` **get** `/accounts/{account_id}/magic/sites/{site_id}/acls` Lists Site ACLs associated with an account. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier ### Returns - `class ACL: …` Bidirectional ACL policy for network traffic within a site. - `id: Optional[str]` Identifier - `description: Optional[str]` Description for the ACL. - `forward_locally: Optional[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. - `lan_1: Optional[ACLConfiguration]` - `lan_id: str` The identifier for the LAN you want to create an ACL policy with. - `lan_name: Optional[str]` The name of the LAN based on the provided lan_id. - `port_ranges: Optional[List[str]]` 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: Optional[List[int]]` 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: Optional[List[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. - `lan_2: Optional[ACLConfiguration]` - `name: Optional[str]` The name of the ACL. - `protocols: Optional[List[AllowedProtocol]]` - `"tcp"` - `"udp"` - `"icmp"` - `unidirectional: Optional[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 ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.magic_transit.sites.acls.list( site_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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 } ``` ## Site ACL Details `magic_transit.sites.acls.get(stracl_id, ACLGetParams**kwargs) -> ACL` **get** `/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_id}` Get a specific Site ACL. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `acl_id: str` Identifier ### Returns - `class ACL: …` Bidirectional ACL policy for network traffic within a site. - `id: Optional[str]` Identifier - `description: Optional[str]` Description for the ACL. - `forward_locally: Optional[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. - `lan_1: Optional[ACLConfiguration]` - `lan_id: str` The identifier for the LAN you want to create an ACL policy with. - `lan_name: Optional[str]` The name of the LAN based on the provided lan_id. - `port_ranges: Optional[List[str]]` 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: Optional[List[int]]` 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: Optional[List[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. - `lan_2: Optional[ACLConfiguration]` - `name: Optional[str]` The name of the ACL. - `protocols: Optional[List[AllowedProtocol]]` - `"tcp"` - `"udp"` - `"icmp"` - `unidirectional: Optional[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 ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) acl = client.magic_transit.sites.acls.get( acl_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `magic_transit.sites.acls.create(strsite_id, ACLCreateParams**kwargs) -> ACL` **post** `/accounts/{account_id}/magic/sites/{site_id}/acls` Creates a new Site ACL. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `lan_1: ACLConfigurationParam` - `lan_id: str` The identifier for the LAN you want to create an ACL policy with. - `lan_name: Optional[str]` The name of the LAN based on the provided lan_id. - `port_ranges: Optional[List[str]]` 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: Optional[List[int]]` 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: Optional[List[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. - `lan_2: ACLConfigurationParam` - `name: str` The name of the ACL. - `description: Optional[str]` Description for the ACL. - `forward_locally: Optional[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. - `protocols: Optional[List[AllowedProtocol]]` - `"tcp"` - `"udp"` - `"icmp"` - `unidirectional: Optional[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. ### Returns - `class ACL: …` Bidirectional ACL policy for network traffic within a site. - `id: Optional[str]` Identifier - `description: Optional[str]` Description for the ACL. - `forward_locally: Optional[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. - `lan_1: Optional[ACLConfiguration]` - `lan_id: str` The identifier for the LAN you want to create an ACL policy with. - `lan_name: Optional[str]` The name of the LAN based on the provided lan_id. - `port_ranges: Optional[List[str]]` 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: Optional[List[int]]` 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: Optional[List[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. - `lan_2: Optional[ACLConfiguration]` - `name: Optional[str]` The name of the ACL. - `protocols: Optional[List[AllowedProtocol]]` - `"tcp"` - `"udp"` - `"icmp"` - `unidirectional: Optional[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 ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) acl = client.magic_transit.sites.acls.create( site_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", lan_1={ "lan_id": "lan_id" }, lan_2={ "lan_id": "lan_id" }, name="PIN Pad - Cash Register", ) print(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 `magic_transit.sites.acls.update(stracl_id, ACLUpdateParams**kwargs) -> ACL` **put** `/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_id}` Update a specific Site ACL. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `acl_id: str` Identifier - `description: Optional[str]` Description for the ACL. - `forward_locally: Optional[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. - `lan_1: Optional[ACLConfigurationParam]` - `lan_id: str` The identifier for the LAN you want to create an ACL policy with. - `lan_name: Optional[str]` The name of the LAN based on the provided lan_id. - `port_ranges: Optional[List[str]]` 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: Optional[List[int]]` 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: Optional[List[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. - `lan_2: Optional[ACLConfigurationParam]` - `name: Optional[str]` The name of the ACL. - `protocols: Optional[List[AllowedProtocol]]` - `"tcp"` - `"udp"` - `"icmp"` - `unidirectional: Optional[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. ### Returns - `class ACL: …` Bidirectional ACL policy for network traffic within a site. - `id: Optional[str]` Identifier - `description: Optional[str]` Description for the ACL. - `forward_locally: Optional[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. - `lan_1: Optional[ACLConfiguration]` - `lan_id: str` The identifier for the LAN you want to create an ACL policy with. - `lan_name: Optional[str]` The name of the LAN based on the provided lan_id. - `port_ranges: Optional[List[str]]` 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: Optional[List[int]]` 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: Optional[List[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. - `lan_2: Optional[ACLConfiguration]` - `name: Optional[str]` The name of the ACL. - `protocols: Optional[List[AllowedProtocol]]` - `"tcp"` - `"udp"` - `"icmp"` - `unidirectional: Optional[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 ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) acl = client.magic_transit.sites.acls.update( acl_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `magic_transit.sites.acls.edit(stracl_id, ACLEditParams**kwargs) -> ACL` **patch** `/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_id}` Patch a specific Site ACL. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `acl_id: str` Identifier - `description: Optional[str]` Description for the ACL. - `forward_locally: Optional[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. - `lan_1: Optional[ACLConfigurationParam]` - `lan_id: str` The identifier for the LAN you want to create an ACL policy with. - `lan_name: Optional[str]` The name of the LAN based on the provided lan_id. - `port_ranges: Optional[List[str]]` 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: Optional[List[int]]` 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: Optional[List[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. - `lan_2: Optional[ACLConfigurationParam]` - `name: Optional[str]` The name of the ACL. - `protocols: Optional[List[AllowedProtocol]]` - `"tcp"` - `"udp"` - `"icmp"` - `unidirectional: Optional[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. ### Returns - `class ACL: …` Bidirectional ACL policy for network traffic within a site. - `id: Optional[str]` Identifier - `description: Optional[str]` Description for the ACL. - `forward_locally: Optional[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. - `lan_1: Optional[ACLConfiguration]` - `lan_id: str` The identifier for the LAN you want to create an ACL policy with. - `lan_name: Optional[str]` The name of the LAN based on the provided lan_id. - `port_ranges: Optional[List[str]]` 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: Optional[List[int]]` 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: Optional[List[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. - `lan_2: Optional[ACLConfiguration]` - `name: Optional[str]` The name of the ACL. - `protocols: Optional[List[AllowedProtocol]]` - `"tcp"` - `"udp"` - `"icmp"` - `unidirectional: Optional[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 ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) acl = client.magic_transit.sites.acls.edit( acl_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `magic_transit.sites.acls.delete(stracl_id, ACLDeleteParams**kwargs) -> ACL` **delete** `/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_id}` Remove a specific Site ACL. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `acl_id: str` Identifier ### Returns - `class ACL: …` Bidirectional ACL policy for network traffic within a site. - `id: Optional[str]` Identifier - `description: Optional[str]` Description for the ACL. - `forward_locally: Optional[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. - `lan_1: Optional[ACLConfiguration]` - `lan_id: str` The identifier for the LAN you want to create an ACL policy with. - `lan_name: Optional[str]` The name of the LAN based on the provided lan_id. - `port_ranges: Optional[List[str]]` 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: Optional[List[int]]` 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: Optional[List[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. - `lan_2: Optional[ACLConfiguration]` - `name: Optional[str]` The name of the ACL. - `protocols: Optional[List[AllowedProtocol]]` - `"tcp"` - `"udp"` - `"icmp"` - `unidirectional: Optional[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 ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) acl = client.magic_transit.sites.acls.delete( acl_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 - `class ACL: …` Bidirectional ACL policy for network traffic within a site. - `id: Optional[str]` Identifier - `description: Optional[str]` Description for the ACL. - `forward_locally: Optional[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. - `lan_1: Optional[ACLConfiguration]` - `lan_id: str` The identifier for the LAN you want to create an ACL policy with. - `lan_name: Optional[str]` The name of the LAN based on the provided lan_id. - `port_ranges: Optional[List[str]]` 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: Optional[List[int]]` 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: Optional[List[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. - `lan_2: Optional[ACLConfiguration]` - `name: Optional[str]` The name of the ACL. - `protocols: Optional[List[AllowedProtocol]]` - `"tcp"` - `"udp"` - `"icmp"` - `unidirectional: Optional[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 - `class ACLConfiguration: …` - `lan_id: str` The identifier for the LAN you want to create an ACL policy with. - `lan_name: Optional[str]` The name of the LAN based on the provided lan_id. - `port_ranges: Optional[List[str]]` 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: Optional[List[int]]` 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: Optional[List[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 - `Literal["tcp", "udp", "icmp"]` Array of allowed communication protocols between configured LANs. If no protocols are provided, all protocols are allowed. - `"tcp"` - `"udp"` - `"icmp"` ### Subnet - `str` A valid IPv4 address. # LANs ## List Site LANs `magic_transit.sites.lans.list(strsite_id, LANListParams**kwargs) -> SyncSinglePage[LAN]` **get** `/accounts/{account_id}/magic/sites/{site_id}/lans` Lists Site LANs associated with an account. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier ### Returns - `class LAN: …` - `id: Optional[str]` Identifier - `bond_id: Optional[int]` - `ha_link: Optional[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. - `is_breakout: Optional[bool]` mark true to use this LAN for source-based breakout traffic - `is_prioritized: Optional[bool]` mark true to use this LAN for source-based prioritized traffic - `name: Optional[str]` - `nat: Optional[Nat]` - `static_prefix: Optional[str]` A valid CIDR notation representing an IP range. - `physport: Optional[int]` - `routed_subnets: Optional[List[RoutedSubnet]]` - `next_hop: str` A valid IPv4 address. - `prefix: str` A valid CIDR notation representing an IP range. - `nat: Optional[Nat]` - `site_id: Optional[str]` Identifier - `static_addressing: Optional[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: str` A valid CIDR notation representing an IP range. - `dhcp_relay: Optional[DHCPRelay]` - `server_addresses: Optional[List[str]]` List of DHCP server IPs. - `dhcp_server: Optional[DHCPServer]` - `dhcp_pool_end: Optional[str]` A valid IPv4 address. - `dhcp_pool_start: Optional[str]` A valid IPv4 address. - `dns_server: Optional[str]` A valid IPv4 address. - `dns_servers: Optional[List[str]]` - `reservations: Optional[Dict[str, str]]` Mapping of MAC addresses to IP addresses - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `virtual_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.magic_transit.sites.lans.list( site_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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 } ``` ## Site LAN Details `magic_transit.sites.lans.get(strlan_id, LANGetParams**kwargs) -> LAN` **get** `/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}` Get a specific Site LAN. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `lan_id: str` Identifier ### Returns - `class LAN: …` - `id: Optional[str]` Identifier - `bond_id: Optional[int]` - `ha_link: Optional[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. - `is_breakout: Optional[bool]` mark true to use this LAN for source-based breakout traffic - `is_prioritized: Optional[bool]` mark true to use this LAN for source-based prioritized traffic - `name: Optional[str]` - `nat: Optional[Nat]` - `static_prefix: Optional[str]` A valid CIDR notation representing an IP range. - `physport: Optional[int]` - `routed_subnets: Optional[List[RoutedSubnet]]` - `next_hop: str` A valid IPv4 address. - `prefix: str` A valid CIDR notation representing an IP range. - `nat: Optional[Nat]` - `site_id: Optional[str]` Identifier - `static_addressing: Optional[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: str` A valid CIDR notation representing an IP range. - `dhcp_relay: Optional[DHCPRelay]` - `server_addresses: Optional[List[str]]` List of DHCP server IPs. - `dhcp_server: Optional[DHCPServer]` - `dhcp_pool_end: Optional[str]` A valid IPv4 address. - `dhcp_pool_start: Optional[str]` A valid IPv4 address. - `dns_server: Optional[str]` A valid IPv4 address. - `dns_servers: Optional[List[str]]` - `reservations: Optional[Dict[str, str]]` Mapping of MAC addresses to IP addresses - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `virtual_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) lan = client.magic_transit.sites.lans.get( lan_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `magic_transit.sites.lans.create(strsite_id, LANCreateParams**kwargs) -> SyncSinglePage[LAN]` **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 - `account_id: str` Identifier - `site_id: str` Identifier - `bond_id: Optional[int]` - `ha_link: Optional[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. - `is_breakout: Optional[bool]` mark true to use this LAN for source-based breakout traffic - `is_prioritized: Optional[bool]` mark true to use this LAN for source-based prioritized traffic - `name: Optional[str]` - `nat: Optional[NatParam]` - `static_prefix: Optional[str]` A valid CIDR notation representing an IP range. - `physport: Optional[int]` - `routed_subnets: Optional[Iterable[RoutedSubnetParam]]` - `next_hop: str` A valid IPv4 address. - `prefix: str` A valid CIDR notation representing an IP range. - `nat: Optional[Nat]` - `static_addressing: Optional[LANStaticAddressingParam]` 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: str` A valid CIDR notation representing an IP range. - `dhcp_relay: Optional[DHCPRelay]` - `server_addresses: Optional[List[str]]` List of DHCP server IPs. - `dhcp_server: Optional[DHCPServer]` - `dhcp_pool_end: Optional[str]` A valid IPv4 address. - `dhcp_pool_start: Optional[str]` A valid IPv4 address. - `dns_server: Optional[str]` A valid IPv4 address. - `dns_servers: Optional[List[str]]` - `reservations: Optional[Dict[str, str]]` Mapping of MAC addresses to IP addresses - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `virtual_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Returns - `class LAN: …` - `id: Optional[str]` Identifier - `bond_id: Optional[int]` - `ha_link: Optional[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. - `is_breakout: Optional[bool]` mark true to use this LAN for source-based breakout traffic - `is_prioritized: Optional[bool]` mark true to use this LAN for source-based prioritized traffic - `name: Optional[str]` - `nat: Optional[Nat]` - `static_prefix: Optional[str]` A valid CIDR notation representing an IP range. - `physport: Optional[int]` - `routed_subnets: Optional[List[RoutedSubnet]]` - `next_hop: str` A valid IPv4 address. - `prefix: str` A valid CIDR notation representing an IP range. - `nat: Optional[Nat]` - `site_id: Optional[str]` Identifier - `static_addressing: Optional[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: str` A valid CIDR notation representing an IP range. - `dhcp_relay: Optional[DHCPRelay]` - `server_addresses: Optional[List[str]]` List of DHCP server IPs. - `dhcp_server: Optional[DHCPServer]` - `dhcp_pool_end: Optional[str]` A valid IPv4 address. - `dhcp_pool_start: Optional[str]` A valid IPv4 address. - `dns_server: Optional[str]` A valid IPv4 address. - `dns_servers: Optional[List[str]]` - `reservations: Optional[Dict[str, str]]` Mapping of MAC addresses to IP addresses - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `virtual_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.magic_transit.sites.lans.create( site_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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 } ``` ## Update Site LAN `magic_transit.sites.lans.update(strlan_id, LANUpdateParams**kwargs) -> LAN` **put** `/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}` Update a specific Site LAN. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `lan_id: str` Identifier - `bond_id: Optional[int]` - `is_breakout: Optional[bool]` mark true to use this LAN for source-based breakout traffic - `is_prioritized: Optional[bool]` mark true to use this LAN for source-based prioritized traffic - `name: Optional[str]` - `nat: Optional[NatParam]` - `static_prefix: Optional[str]` A valid CIDR notation representing an IP range. - `physport: Optional[int]` - `routed_subnets: Optional[Iterable[RoutedSubnetParam]]` - `next_hop: str` A valid IPv4 address. - `prefix: str` A valid CIDR notation representing an IP range. - `nat: Optional[Nat]` - `static_addressing: Optional[LANStaticAddressingParam]` 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: str` A valid CIDR notation representing an IP range. - `dhcp_relay: Optional[DHCPRelay]` - `server_addresses: Optional[List[str]]` List of DHCP server IPs. - `dhcp_server: Optional[DHCPServer]` - `dhcp_pool_end: Optional[str]` A valid IPv4 address. - `dhcp_pool_start: Optional[str]` A valid IPv4 address. - `dns_server: Optional[str]` A valid IPv4 address. - `dns_servers: Optional[List[str]]` - `reservations: Optional[Dict[str, str]]` Mapping of MAC addresses to IP addresses - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `virtual_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Returns - `class LAN: …` - `id: Optional[str]` Identifier - `bond_id: Optional[int]` - `ha_link: Optional[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. - `is_breakout: Optional[bool]` mark true to use this LAN for source-based breakout traffic - `is_prioritized: Optional[bool]` mark true to use this LAN for source-based prioritized traffic - `name: Optional[str]` - `nat: Optional[Nat]` - `static_prefix: Optional[str]` A valid CIDR notation representing an IP range. - `physport: Optional[int]` - `routed_subnets: Optional[List[RoutedSubnet]]` - `next_hop: str` A valid IPv4 address. - `prefix: str` A valid CIDR notation representing an IP range. - `nat: Optional[Nat]` - `site_id: Optional[str]` Identifier - `static_addressing: Optional[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: str` A valid CIDR notation representing an IP range. - `dhcp_relay: Optional[DHCPRelay]` - `server_addresses: Optional[List[str]]` List of DHCP server IPs. - `dhcp_server: Optional[DHCPServer]` - `dhcp_pool_end: Optional[str]` A valid IPv4 address. - `dhcp_pool_start: Optional[str]` A valid IPv4 address. - `dns_server: Optional[str]` A valid IPv4 address. - `dns_servers: Optional[List[str]]` - `reservations: Optional[Dict[str, str]]` Mapping of MAC addresses to IP addresses - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `virtual_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) lan = client.magic_transit.sites.lans.update( lan_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `magic_transit.sites.lans.edit(strlan_id, LANEditParams**kwargs) -> LAN` **patch** `/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}` Patch a specific Site LAN. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `lan_id: str` Identifier - `bond_id: Optional[int]` - `is_breakout: Optional[bool]` mark true to use this LAN for source-based breakout traffic - `is_prioritized: Optional[bool]` mark true to use this LAN for source-based prioritized traffic - `name: Optional[str]` - `nat: Optional[NatParam]` - `static_prefix: Optional[str]` A valid CIDR notation representing an IP range. - `physport: Optional[int]` - `routed_subnets: Optional[Iterable[RoutedSubnetParam]]` - `next_hop: str` A valid IPv4 address. - `prefix: str` A valid CIDR notation representing an IP range. - `nat: Optional[Nat]` - `static_addressing: Optional[LANStaticAddressingParam]` 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: str` A valid CIDR notation representing an IP range. - `dhcp_relay: Optional[DHCPRelay]` - `server_addresses: Optional[List[str]]` List of DHCP server IPs. - `dhcp_server: Optional[DHCPServer]` - `dhcp_pool_end: Optional[str]` A valid IPv4 address. - `dhcp_pool_start: Optional[str]` A valid IPv4 address. - `dns_server: Optional[str]` A valid IPv4 address. - `dns_servers: Optional[List[str]]` - `reservations: Optional[Dict[str, str]]` Mapping of MAC addresses to IP addresses - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `virtual_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Returns - `class LAN: …` - `id: Optional[str]` Identifier - `bond_id: Optional[int]` - `ha_link: Optional[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. - `is_breakout: Optional[bool]` mark true to use this LAN for source-based breakout traffic - `is_prioritized: Optional[bool]` mark true to use this LAN for source-based prioritized traffic - `name: Optional[str]` - `nat: Optional[Nat]` - `static_prefix: Optional[str]` A valid CIDR notation representing an IP range. - `physport: Optional[int]` - `routed_subnets: Optional[List[RoutedSubnet]]` - `next_hop: str` A valid IPv4 address. - `prefix: str` A valid CIDR notation representing an IP range. - `nat: Optional[Nat]` - `site_id: Optional[str]` Identifier - `static_addressing: Optional[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: str` A valid CIDR notation representing an IP range. - `dhcp_relay: Optional[DHCPRelay]` - `server_addresses: Optional[List[str]]` List of DHCP server IPs. - `dhcp_server: Optional[DHCPServer]` - `dhcp_pool_end: Optional[str]` A valid IPv4 address. - `dhcp_pool_start: Optional[str]` A valid IPv4 address. - `dns_server: Optional[str]` A valid IPv4 address. - `dns_servers: Optional[List[str]]` - `reservations: Optional[Dict[str, str]]` Mapping of MAC addresses to IP addresses - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `virtual_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) lan = client.magic_transit.sites.lans.edit( lan_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `magic_transit.sites.lans.delete(strlan_id, LANDeleteParams**kwargs) -> LAN` **delete** `/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}` Remove a specific Site LAN. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `lan_id: str` Identifier ### Returns - `class LAN: …` - `id: Optional[str]` Identifier - `bond_id: Optional[int]` - `ha_link: Optional[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. - `is_breakout: Optional[bool]` mark true to use this LAN for source-based breakout traffic - `is_prioritized: Optional[bool]` mark true to use this LAN for source-based prioritized traffic - `name: Optional[str]` - `nat: Optional[Nat]` - `static_prefix: Optional[str]` A valid CIDR notation representing an IP range. - `physport: Optional[int]` - `routed_subnets: Optional[List[RoutedSubnet]]` - `next_hop: str` A valid IPv4 address. - `prefix: str` A valid CIDR notation representing an IP range. - `nat: Optional[Nat]` - `site_id: Optional[str]` Identifier - `static_addressing: Optional[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: str` A valid CIDR notation representing an IP range. - `dhcp_relay: Optional[DHCPRelay]` - `server_addresses: Optional[List[str]]` List of DHCP server IPs. - `dhcp_server: Optional[DHCPServer]` - `dhcp_pool_end: Optional[str]` A valid IPv4 address. - `dhcp_pool_start: Optional[str]` A valid IPv4 address. - `dns_server: Optional[str]` A valid IPv4 address. - `dns_servers: Optional[List[str]]` - `reservations: Optional[Dict[str, str]]` Mapping of MAC addresses to IP addresses - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `virtual_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) lan = client.magic_transit.sites.lans.delete( lan_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 - `class DHCPRelay: …` - `server_addresses: Optional[List[str]]` List of DHCP server IPs. ### DHCP Server - `class DHCPServer: …` - `dhcp_pool_end: Optional[str]` A valid IPv4 address. - `dhcp_pool_start: Optional[str]` A valid IPv4 address. - `dns_server: Optional[str]` A valid IPv4 address. - `dns_servers: Optional[List[str]]` - `reservations: Optional[Dict[str, str]]` Mapping of MAC addresses to IP addresses ### LAN - `class LAN: …` - `id: Optional[str]` Identifier - `bond_id: Optional[int]` - `ha_link: Optional[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. - `is_breakout: Optional[bool]` mark true to use this LAN for source-based breakout traffic - `is_prioritized: Optional[bool]` mark true to use this LAN for source-based prioritized traffic - `name: Optional[str]` - `nat: Optional[Nat]` - `static_prefix: Optional[str]` A valid CIDR notation representing an IP range. - `physport: Optional[int]` - `routed_subnets: Optional[List[RoutedSubnet]]` - `next_hop: str` A valid IPv4 address. - `prefix: str` A valid CIDR notation representing an IP range. - `nat: Optional[Nat]` - `site_id: Optional[str]` Identifier - `static_addressing: Optional[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: str` A valid CIDR notation representing an IP range. - `dhcp_relay: Optional[DHCPRelay]` - `server_addresses: Optional[List[str]]` List of DHCP server IPs. - `dhcp_server: Optional[DHCPServer]` - `dhcp_pool_end: Optional[str]` A valid IPv4 address. - `dhcp_pool_start: Optional[str]` A valid IPv4 address. - `dns_server: Optional[str]` A valid IPv4 address. - `dns_servers: Optional[List[str]]` - `reservations: Optional[Dict[str, str]]` Mapping of MAC addresses to IP addresses - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `virtual_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### LAN Static Addressing - `class 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: str` A valid CIDR notation representing an IP range. - `dhcp_relay: Optional[DHCPRelay]` - `server_addresses: Optional[List[str]]` List of DHCP server IPs. - `dhcp_server: Optional[DHCPServer]` - `dhcp_pool_end: Optional[str]` A valid IPv4 address. - `dhcp_pool_start: Optional[str]` A valid IPv4 address. - `dns_server: Optional[str]` A valid IPv4 address. - `dns_servers: Optional[List[str]]` - `reservations: Optional[Dict[str, str]]` Mapping of MAC addresses to IP addresses - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `virtual_address: Optional[str]` A valid CIDR notation representing an IP range. ### Nat - `class Nat: …` - `static_prefix: Optional[str]` A valid CIDR notation representing an IP range. ### Routed Subnet - `class RoutedSubnet: …` - `next_hop: str` A valid IPv4 address. - `prefix: str` A valid CIDR notation representing an IP range. - `nat: Optional[Nat]` - `static_prefix: Optional[str]` A valid CIDR notation representing an IP range. # WANs ## List Site WANs `magic_transit.sites.wans.list(strsite_id, WANListParams**kwargs) -> SyncSinglePage[WAN]` **get** `/accounts/{account_id}/magic/sites/{site_id}/wans` Lists Site WANs associated with an account. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier ### Returns - `class WAN: …` - `id: Optional[str]` Identifier - `health_check_rate: Optional[Literal["low", "mid", "high"]]` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `"low"` - `"mid"` - `"high"` - `name: Optional[str]` - `physport: Optional[int]` - `priority: Optional[int]` Priority of WAN for traffic loadbalancing. - `site_id: Optional[str]` Identifier - `static_addressing: Optional[WANStaticAddressing]` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `address: str` A valid CIDR notation representing an IP range. - `gateway_address: str` A valid IPv4 address. - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.magic_transit.sites.wans.list( site_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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 } ``` ## Site WAN Details `magic_transit.sites.wans.get(strwan_id, WANGetParams**kwargs) -> WAN` **get** `/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}` Get a specific Site WAN. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `wan_id: str` Identifier ### Returns - `class WAN: …` - `id: Optional[str]` Identifier - `health_check_rate: Optional[Literal["low", "mid", "high"]]` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `"low"` - `"mid"` - `"high"` - `name: Optional[str]` - `physport: Optional[int]` - `priority: Optional[int]` Priority of WAN for traffic loadbalancing. - `site_id: Optional[str]` Identifier - `static_addressing: Optional[WANStaticAddressing]` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `address: str` A valid CIDR notation representing an IP range. - `gateway_address: str` A valid IPv4 address. - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) wan = client.magic_transit.sites.wans.get( wan_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `magic_transit.sites.wans.create(strsite_id, WANCreateParams**kwargs) -> SyncSinglePage[WAN]` **post** `/accounts/{account_id}/magic/sites/{site_id}/wans` Creates a new Site WAN. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `physport: int` - `name: Optional[str]` - `priority: Optional[int]` - `static_addressing: Optional[WANStaticAddressingParam]` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `address: str` A valid CIDR notation representing an IP range. - `gateway_address: str` A valid IPv4 address. - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Returns - `class WAN: …` - `id: Optional[str]` Identifier - `health_check_rate: Optional[Literal["low", "mid", "high"]]` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `"low"` - `"mid"` - `"high"` - `name: Optional[str]` - `physport: Optional[int]` - `priority: Optional[int]` Priority of WAN for traffic loadbalancing. - `site_id: Optional[str]` Identifier - `static_addressing: Optional[WANStaticAddressing]` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `address: str` A valid CIDR notation representing an IP range. - `gateway_address: str` A valid IPv4 address. - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.magic_transit.sites.wans.create( site_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", physport=1, ) page = page.result[0] print(page.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 } ``` ## Update Site WAN `magic_transit.sites.wans.update(strwan_id, WANUpdateParams**kwargs) -> WAN` **put** `/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}` Update a specific Site WAN. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `wan_id: str` Identifier - `name: Optional[str]` - `physport: Optional[int]` - `priority: Optional[int]` - `static_addressing: Optional[WANStaticAddressingParam]` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `address: str` A valid CIDR notation representing an IP range. - `gateway_address: str` A valid IPv4 address. - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Returns - `class WAN: …` - `id: Optional[str]` Identifier - `health_check_rate: Optional[Literal["low", "mid", "high"]]` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `"low"` - `"mid"` - `"high"` - `name: Optional[str]` - `physport: Optional[int]` - `priority: Optional[int]` Priority of WAN for traffic loadbalancing. - `site_id: Optional[str]` Identifier - `static_addressing: Optional[WANStaticAddressing]` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `address: str` A valid CIDR notation representing an IP range. - `gateway_address: str` A valid IPv4 address. - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) wan = client.magic_transit.sites.wans.update( wan_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `magic_transit.sites.wans.edit(strwan_id, WANEditParams**kwargs) -> WAN` **patch** `/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}` Patch a specific Site WAN. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `wan_id: str` Identifier - `name: Optional[str]` - `physport: Optional[int]` - `priority: Optional[int]` - `static_addressing: Optional[WANStaticAddressingParam]` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `address: str` A valid CIDR notation representing an IP range. - `gateway_address: str` A valid IPv4 address. - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Returns - `class WAN: …` - `id: Optional[str]` Identifier - `health_check_rate: Optional[Literal["low", "mid", "high"]]` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `"low"` - `"mid"` - `"high"` - `name: Optional[str]` - `physport: Optional[int]` - `priority: Optional[int]` Priority of WAN for traffic loadbalancing. - `site_id: Optional[str]` Identifier - `static_addressing: Optional[WANStaticAddressing]` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `address: str` A valid CIDR notation representing an IP range. - `gateway_address: str` A valid IPv4 address. - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) wan = client.magic_transit.sites.wans.edit( wan_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `magic_transit.sites.wans.delete(strwan_id, WANDeleteParams**kwargs) -> WAN` **delete** `/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}` Remove a specific Site WAN. ### Parameters - `account_id: str` Identifier - `site_id: str` Identifier - `wan_id: str` Identifier ### Returns - `class WAN: …` - `id: Optional[str]` Identifier - `health_check_rate: Optional[Literal["low", "mid", "high"]]` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `"low"` - `"mid"` - `"high"` - `name: Optional[str]` - `physport: Optional[int]` - `priority: Optional[int]` Priority of WAN for traffic loadbalancing. - `site_id: Optional[str]` Identifier - `static_addressing: Optional[WANStaticAddressing]` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `address: str` A valid CIDR notation representing an IP range. - `gateway_address: str` A valid IPv4 address. - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) wan = client.magic_transit.sites.wans.delete( wan_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 - `class WAN: …` - `id: Optional[str]` Identifier - `health_check_rate: Optional[Literal["low", "mid", "high"]]` Magic WAN health check rate for tunnels created on this link. The default value is `mid`. - `"low"` - `"mid"` - `"high"` - `name: Optional[str]` - `physport: Optional[int]` - `priority: Optional[int]` Priority of WAN for traffic loadbalancing. - `site_id: Optional[str]` Identifier - `static_addressing: Optional[WANStaticAddressing]` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `address: str` A valid CIDR notation representing an IP range. - `gateway_address: str` A valid IPv4 address. - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range. - `vlan_tag: Optional[int]` VLAN ID. Use zero for untagged. ### WAN Static Addressing - `class WANStaticAddressing: …` (optional) if omitted, use DHCP. Submit secondary_address when site is in high availability mode. - `address: str` A valid CIDR notation representing an IP range. - `gateway_address: str` A valid IPv4 address. - `secondary_address: Optional[str]` A valid CIDR notation representing an IP range.