{"openapi":"3.0.0","info":{"title":"OVHcloud API specification","description":"Specification for OVHcloud API","version":"1.0","contact":{"name":"OVH","email":"api@ml.ovh.net"}},"servers":[{"url":"https://api.eu.ovhcloud.com/v2"}],"components":{"schemas":{"any":{"description":"Can be anything (text, int, bool, json, html, etc.)","example":"This is a content of any type !"},"common.CurrentTask":{"type":"object","description":"Asynchronous operation currently running","properties":{"errors":{"type":"array","description":"Errors that occurred on the task","nullable":true,"items":{"$ref":"#/components/schemas/common.TaskError"},"readOnly":true},"id":{"type":"string","description":"Identifier of the current task","format":"uuid","readOnly":true},"link":{"type":"string","description":"Link to the task details","readOnly":true},"status":{"allOf":[{"$ref":"#/components/schemas/common.CurrentTaskStatusEnum"}],"description":"Current global status of the current task","nullable":true,"readOnly":true},"type":{"type":"string","description":"Type of the current task","readOnly":true}}},"common.CurrentTaskStatusEnum":{"type":"string","description":"Current status of a task. A task in ERROR cannot be retried without your inputs. PENDING tasks will be executed as soon as possible. A RUNNING task is currently executing your original request. SCHEDULED is used for tasks that will be executed in the future.","enum":["ERROR","PENDING","RUNNING","SCHEDULED","WAITING_USER_INPUT"]},"common.ResourceStatusEnum":{"type":"string","description":"Current status of a resource","enum":["CREATING","CREATION_PLANNED","DELETING","ERROR","OUT_OF_SYNC","READY","SUSPENDED","UNKNOWN","UPDATING"]},"common.TaskError":{"type":"object","description":"Errors that occurred on the task","properties":{"message":{"type":"string","description":"Error description","readOnly":true}}},"duration":{"type":"string","description":"Duration (e.g., P1Y2M3DT4H6M9S)","example":"P1Y2M3DT4H6M9S"},"email":{"type":"string","description":"Email address (e.g., api@ml.ovh.net)","format":"email","example":"api@ml.ovh.net"},"internationalPhoneNumber":{"type":"string","description":"International phone number","format":"phone-number"},"ip":{"type":"string","description":"IP address (e.g., 192.0.2.0)","format":"ipv4","example":"192.0.2.0"},"ipBlock":{"type":"string","description":"IP (v4 or v6) CIDR notation (e.g., 192.0.2.0/24)","format":"ip-block","example":"192.0.2.0/24"},"ipInterface":{"type":"string","description":"IP address (e.g., 192.0.2.0)","format":"ipv4","example":"192.0.2.0"},"ipv4":{"type":"string","description":"IPv4 address (e.g., 192.0.2.0)","format":"ipv4","example":"192.0.2.0"},"ipv4Block":{"type":"string","description":"IPv4 CIDR notation (e.g., 192.0.2.0/24)","format":"ipv4-block","example":"192.0.2.0/24"},"ipv6":{"type":"string","description":"IPv6 address (e.g., 2001:41d0:1:1994::1)","format":"ipv6","example":"2001:41d0:1:1994::1"},"ipv6Block":{"type":"string","description":"IPv6 CIDR notation (e.g., 2001:41d0::/128)","format":"ipv6-block","example":"2001:41d0::/128"},"macAddress":{"type":"string","description":"MAC address (e.g., 00:00:5e:00:53:01)","format":"mac-address","example":"00:00:5e:00:53:01"},"phoneNumber":{"type":"string","description":"Phone number","format":"phone-number"},"publicCloud.common.Location":{"type":"object","description":"Resource location","properties":{"availabilityZone":{"type":"string","description":"Availability zone within the region","nullable":true},"region":{"type":"string","description":"Region code"}},"required":["region"]},"publicCloud.network.Subnet":{"type":"object","description":"A Public Cloud subnet","properties":{"checksum":{"type":"string","description":"Computed hash representing the current target specification value","readOnly":true},"createdAt":{"type":"string","description":"Creation date of the subnet","format":"date-time","readOnly":true},"currentState":{"allOf":[{"$ref":"#/components/schemas/publicCloud.network.SubnetCurrentState"}],"description":"Current state of the subnet","nullable":true,"readOnly":true},"currentTasks":{"type":"array","description":"Ongoing asynchronous tasks related to the subnet","nullable":true,"items":{"$ref":"#/components/schemas/common.CurrentTask"},"readOnly":true},"id":{"type":"string","description":"Unique identifier of the subnet","format":"uuid","readOnly":true},"resourceStatus":{"allOf":[{"$ref":"#/components/schemas/common.ResourceStatusEnum"}],"description":"Subnet readiness in the system","readOnly":true},"targetSpec":{"allOf":[{"$ref":"#/components/schemas/publicCloud.network.SubnetTargetSpec"}],"description":"Last target specification of the subnet","readOnly":true},"updatedAt":{"type":"string","description":"Last update date of the subnet","format":"date-time","readOnly":true}}},"publicCloud.network.SubnetAllocationPool":{"type":"object","description":"IP address pool for dynamic allocation within a subnet","properties":{"end":{"allOf":[{"$ref":"#/components/schemas/ip"}],"description":"End IP address of the pool"},"start":{"allOf":[{"$ref":"#/components/schemas/ip"}],"description":"Start IP address of the pool"}},"required":["end","start"]},"publicCloud.network.SubnetCreation":{"type":"object","description":"Payload to create a Public Cloud subnet","properties":{"targetSpec":{"allOf":[{"$ref":"#/components/schemas/publicCloud.network.SubnetTargetSpec"}],"description":"Desired target specification for the subnet to create"}},"required":["targetSpec"]},"publicCloud.network.SubnetCurrentState":{"type":"object","description":"Current state of a subnet from OpenStack","properties":{"allocationPools":{"type":"array","description":"Ranges inside the subnet that addresses are handed out from automatically. Addresses outside them stay free for you to assign yourself.","nullable":true,"items":{"$ref":"#/components/schemas/publicCloud.network.SubnetAllocationPool"},"readOnly":true},"cidr":{"allOf":[{"$ref":"#/components/schemas/ipBlock"}],"description":"CIDR address range","readOnly":true},"description":{"type":"string","description":"Subnet description","readOnly":true},"dhcpEnabled":{"type":"boolean","description":"Whether DHCP is enabled","readOnly":true},"dnsNameservers":{"type":"array","description":"DNS resolvers handed to instances attached to this subnet. Null or empty when the default resolvers are used.","nullable":true,"items":{"type":"string"},"readOnly":true},"gatewayIp":{"allOf":[{"$ref":"#/components/schemas/ip"}],"description":"Default gateway IP","nullable":true,"readOnly":true},"hostRoutes":{"type":"array","description":"Static host routes","nullable":true,"items":{"$ref":"#/components/schemas/publicCloud.network.SubnetHostRoute"},"readOnly":true},"location":{"allOf":[{"$ref":"#/components/schemas/publicCloud.common.Location"}],"description":"Location details","readOnly":true},"name":{"type":"string","description":"Subnet name","readOnly":true}}},"publicCloud.network.SubnetHostRoute":{"type":"object","description":"Static host route for devices in a subnet","properties":{"destination":{"allOf":[{"$ref":"#/components/schemas/ipBlock"}],"description":"CIDR reached through the next hop"},"nextHop":{"allOf":[{"$ref":"#/components/schemas/ip"}],"description":"IP address, inside the subnet, that traffic to the destination is sent to"}},"required":["destination","nextHop"]},"publicCloud.network.SubnetPutTargetSpec":{"type":"object","description":"Desired specification for updating a subnet (excludes immutable fields). A field left out or set to null is removed, or set back to the value a subnet created without it gets.","properties":{"allocationPools":{"type":"array","description":"IP address allocation pools. When omitted, the subnet gets the pools of a subnet created without them.","nullable":true,"items":{"$ref":"#/components/schemas/publicCloud.network.SubnetAllocationPool"}},"description":{"type":"string","description":"Subnet description. When omitted, the description is removed.","nullable":true},"dhcpEnabled":{"type":"boolean","description":"Whether DHCP is enabled. When omitted, DHCP is enabled.","nullable":true},"dnsNameservers":{"type":"array","description":"DNS nameservers for the subnet. When omitted, the subnet gets the default DNS nameservers of a subnet created without them (none on IPv6).","nullable":true,"items":{"type":"string"}},"gatewayIp":{"allOf":[{"$ref":"#/components/schemas/ip"}],"description":"Default gateway IP address. When omitted, the subnet has no gateway.","nullable":true},"hostRoutes":{"type":"array","description":"Static routes handed to the instances of the subnet through DHCP. A list replaces the current routes. When omitted, null or empty, all routes are removed.","nullable":true,"items":{"$ref":"#/components/schemas/publicCloud.network.SubnetHostRoute"}},"name":{"type":"string","description":"Subnet name"}},"required":["name"]},"publicCloud.network.SubnetTargetSpec":{"type":"object","description":"Desired specification for a subnet","properties":{"allocationPools":{"type":"array","description":"IP address allocation pools. When omitted, the pools are generated from the CIDR range.","nullable":true,"items":{"$ref":"#/components/schemas/publicCloud.network.SubnetAllocationPool"}},"cidr":{"allOf":[{"$ref":"#/components/schemas/ipBlock"}],"description":"CIDR address range. Immutable after creation."},"description":{"type":"string","description":"Subnet description","nullable":true},"dhcpEnabled":{"type":"boolean","description":"Whether DHCP is enabled. When omitted, DHCP is enabled.","nullable":true},"dnsNameservers":{"type":"array","description":"DNS nameservers for the subnet. When omitted, an IPv4 subnet gets the default OVHcloud DNS nameserver and an IPv6 subnet gets none.","nullable":true,"items":{"type":"string"}},"gatewayIp":{"allOf":[{"$ref":"#/components/schemas/ip"}],"description":"Default gateway IP address. When omitted, the subnet has no gateway.","nullable":true},"hostRoutes":{"type":"array","description":"Static routes handed to the instances of the subnet through DHCP. When omitted, the subnet has no static routes. Null when the subnet has no static route.","nullable":true,"items":{"$ref":"#/components/schemas/publicCloud.network.SubnetHostRoute"}},"location":{"allOf":[{"$ref":"#/components/schemas/publicCloud.common.Location"}],"description":"Target location"},"name":{"type":"string","description":"Subnet name"}},"required":["cidr","location","name"]},"publicCloud.network.SubnetUpdate":{"type":"object","description":"Payload to update a Public Cloud subnet","properties":{"checksum":{"type":"string","description":"Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins).","nullable":true},"targetSpec":{"allOf":[{"$ref":"#/components/schemas/publicCloud.network.SubnetPutTargetSpec"}],"description":"Desired target specification for the subnet"}},"required":["targetSpec"]},"time":{"type":"string","description":"Time (e.g., 15:04:05)","format":"time","example":"15:04:05"}},"securitySchemes":{"oAuth2AuthCode":{"type":"oauth2","description":"Oauth2","x-client-id":"1bb9c7df371741c0","x-client-secret":"a5b4de870aca620d10fbf63cd18d205b","flows":{"authorizationCode":{"authorizationUrl":"https://auth.eu.ovhcloud.com/oauth2/authorize","tokenUrl":"https://auth.eu.ovhcloud.com/oauth2/token","scopes":{"account/all":"Manage your account","all":"Manage your whole account and all your services","services/all":"Manage your services lifecycle and billing"}}}}}},"paths":{"/publicCloud/project/{projectId}/network/{networkId}/subnet":{"get":{"operationId":"getSubnets","summary":"List subnets","description":"Returns the subnets of the network.","security":[{"oAuth2AuthCode":[]}],"parameters":[{"in":"header","name":"X-Pagination-Cursor","description":"Pagination cursor","schema":{"type":"string"}},{"in":"header","name":"X-Pagination-Size","description":"Pagination size","schema":{"type":"integer"}},{"in":"path","name":"networkId","description":"Network ID","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"projectId","description":"Project ID","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/publicCloud.network.Subnet"}}}}}},"tags":["Network"],"x-developer-hub-navigation":[["Public Cloud","Network","Subnets@@@10"]],"x-badges":[{"color":"green","label":"Stable production version"}],"x-code-samples":[{"lang":"python","label":"Python","source":"'''\nFirst, install the latest release of Python wrapper: $ pip install ovh\n'''\nimport json\nimport ovh\n\n# Instantiate an OVH Client.\n# You can generate new credentials with full access to your account on\n# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)\nclient = ovh.Client(\n\tendpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)\n\tapplication_key='xxxxxxxxxx',    # Application Key\n\tapplication_secret='xxxxxxxxxx', # Application Secret\n\tconsumer_key='xxxxxxxxxx',       # Consumer Key\n)\n\nresult = client.get(\"/v2/publicCloud/project/{projectId}/network/{networkId}/subnet\")\n\n# Pretty print\nprint(json.dumps(result, indent=4))"},{"lang":"php","label":"PHP","source":"<?php\n/**\n * First, download the latest release of PHP wrapper on github\n * And include this script into the folder with extracted files\n */\nrequire __DIR__ . '/vendor/autoload.php';\nuse \\Ovh\\Api;\n\n/**\n * Instantiate an OVH Client.\n * You can generate new credentials with full access to your account on\n * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)\n */\n$ovh = new Api('xxxxxxxxxx',  // Application Key\n               'xxxxxxxxxx',  // Application Secret\n               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)\n               'xxxxxxxxxx'); // Consumer Key\n\n$result = $ovh->get(\"/v2/publicCloud/project/{projectId}/network/{networkId}/subnet\");\n\nprint_r($result);\n?>"}],"x-iam-actions":[{"name":"publicCloudProject:apiovh:network/subnet/get","required":true}],"x-response-identifier":"id","x-expanded-response":"PublicCloudNetworkSubnet"},"post":{"operationId":"createSubnet","summary":"Create a subnet","description":"Creates a subnet within the network's address space. The CIDR is immutable after creation.","security":[{"oAuth2AuthCode":[]}],"parameters":[{"in":"path","name":"networkId","description":"Network ID","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"projectId","description":"Project ID","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/publicCloud.network.SubnetCreation"},"examples":{"Create a subnet":{"value":{"targetSpec":{"allocationPools":[{"end":"192.0.2.100","start":"192.0.2.10"}],"cidr":"192.0.2.0/24","dhcpEnabled":true,"dnsNameservers":["8.8.8.8"],"gatewayIp":"192.0.2.1","location":{"region":"GRA1"},"name":"private-subnet-gra1"}},"summary":"Create a subnet with a gateway, DHCP and an allocation pool"}}}}},"responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/publicCloud.network.Subnet"}}}},"409":{"description":"Error 409 response","content":{"application/json":{"schema":{"type":"object","description":"Common error model","properties":{"class":{"type":"string","description":"Class of the error"},"message":{"type":"string","description":"Error message"}}},"examples":{"Client::Conflict::RegionInMaintenance":{"value":{"class":"Client::Conflict::RegionInMaintenance","message":"This region is currently in maintenance"}}}}}}},"tags":["Network"],"x-developer-hub-navigation":[["Public Cloud","Network","Subnets@@@30"]],"x-badges":[{"color":"green","label":"Stable production version"}],"x-code-samples":[{"lang":"python","label":"Python","source":"'''\nFirst, install the latest release of Python wrapper: $ pip install ovh\n'''\nimport json\nimport ovh\n\n# Instantiate an OVH Client.\n# You can generate new credentials with full access to your account on\n# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)\nclient = ovh.Client(\n\tendpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)\n\tapplication_key='xxxxxxxxxx',    # Application Key\n\tapplication_secret='xxxxxxxxxx', # Application Secret\n\tconsumer_key='xxxxxxxxxx',       # Consumer Key\n)\n\n# Request body type: publicCloud.network.SubnetCreation\nresult = client.post(\"/v2/publicCloud/project/{projectId}/network/{networkId}/subnet\",\n\ttargetSpec = None, # Desired target specification for the subnet to create (type: publicCloud.network.SubnetTargetSpec)\n)\n\n# Pretty print\nprint(json.dumps(result, indent=4))"},{"lang":"php","label":"PHP","source":"<?php\n/**\n * First, download the latest release of PHP wrapper on github\n * And include this script into the folder with extracted files\n */\nrequire __DIR__ . '/vendor/autoload.php';\nuse \\Ovh\\Api;\n\n/**\n * Instantiate an OVH Client.\n * You can generate new credentials with full access to your account on\n * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)\n */\n$ovh = new Api('xxxxxxxxxx',  // Application Key\n               'xxxxxxxxxx',  // Application Secret\n               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)\n               'xxxxxxxxxx'); // Consumer Key\n\n// Request body type: publicCloud.network.SubnetCreation\n$result = $ovh->post(\"/v2/publicCloud/project/{projectId}/network/{networkId}/subnet\", array(\n\ttargetSpec => null, // Desired target specification for the subnet to create (type: publicCloud.network.SubnetTargetSpec)\n));\n\nprint_r($result);\n?>"}],"x-iam-actions":[{"name":"publicCloudProject:apiovh:network/subnet/create","required":true}]}},"/publicCloud/project/{projectId}/network/{networkId}/subnet/{subnetId}":{"delete":{"operationId":"deleteSubnet","summary":"Delete a subnet","description":"Deletes the subnet.","security":[{"oAuth2AuthCode":[]}],"parameters":[{"in":"path","name":"networkId","description":"Network ID","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"projectId","description":"Project ID","required":true,"schema":{"type":"string"}},{"in":"path","name":"subnetId","description":"Subnet ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/publicCloud.network.Subnet"}}}},"404":{"description":"Error 404 response","content":{"application/json":{"schema":{"type":"object","description":"Common error model","properties":{"class":{"type":"string","description":"Class of the error"},"message":{"type":"string","description":"Error message"}}},"examples":{"Client::NotFound::SubnetDoesNotExist":{"value":{"class":"Client::NotFound::SubnetDoesNotExist","message":"Subnet not found"}}}}}},"409":{"description":"Error 409 response","content":{"application/json":{"schema":{"type":"object","description":"Common error model","properties":{"class":{"type":"string","description":"Class of the error"},"message":{"type":"string","description":"Error message"}}},"examples":{"Client::Conflict::ResourceAlreadyBeingDeleted":{"value":{"class":"Client::Conflict::ResourceAlreadyBeingDeleted","message":"Resource is already being deleted"}},"Client::Conflict::ResourceInInvalidState":{"value":{"class":"Client::Conflict::ResourceInInvalidState","message":"Resource cannot be modified in its current state"}}}}}}},"tags":["Network"],"x-developer-hub-navigation":[["Public Cloud","Network","Subnets@@@40"]],"x-badges":[{"color":"green","label":"Stable production version"}],"x-code-samples":[{"lang":"python","label":"Python","source":"'''\nFirst, install the latest release of Python wrapper: $ pip install ovh\n'''\nimport json\nimport ovh\n\n# Instantiate an OVH Client.\n# You can generate new credentials with full access to your account on\n# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)\nclient = ovh.Client(\n\tendpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)\n\tapplication_key='xxxxxxxxxx',    # Application Key\n\tapplication_secret='xxxxxxxxxx', # Application Secret\n\tconsumer_key='xxxxxxxxxx',       # Consumer Key\n)\n\nresult = client.delete(\"/v2/publicCloud/project/{projectId}/network/{networkId}/subnet/{subnetId}\")\n\n# Pretty print\nprint(json.dumps(result, indent=4))"},{"lang":"php","label":"PHP","source":"<?php\n/**\n * First, download the latest release of PHP wrapper on github\n * And include this script into the folder with extracted files\n */\nrequire __DIR__ . '/vendor/autoload.php';\nuse \\Ovh\\Api;\n\n/**\n * Instantiate an OVH Client.\n * You can generate new credentials with full access to your account on\n * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)\n */\n$ovh = new Api('xxxxxxxxxx',  // Application Key\n               'xxxxxxxxxx',  // Application Secret\n               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)\n               'xxxxxxxxxx'); // Consumer Key\n\n$result = $ovh->delete(\"/v2/publicCloud/project/{projectId}/network/{networkId}/subnet/{subnetId}\");\n\nprint_r($result);\n?>"}],"x-iam-actions":[{"name":"publicCloudProject:apiovh:network/subnet/delete","required":true}]},"get":{"operationId":"getSubnet","summary":"Get a subnet","description":"Returns the subnet, including its gateway IP and allocation pools.","security":[{"oAuth2AuthCode":[]}],"parameters":[{"in":"path","name":"networkId","description":"Network ID","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"projectId","description":"Project ID","required":true,"schema":{"type":"string"}},{"in":"path","name":"subnetId","description":"Subnet ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/publicCloud.network.Subnet"}}}},"404":{"description":"Error 404 response","content":{"application/json":{"schema":{"type":"object","description":"Common error model","properties":{"class":{"type":"string","description":"Class of the error"},"message":{"type":"string","description":"Error message"}}},"examples":{"Client::NotFound::SubnetDoesNotExist":{"value":{"class":"Client::NotFound::SubnetDoesNotExist","message":"Subnet not found"}}}}}}},"tags":["Network"],"x-developer-hub-navigation":[["Public Cloud","Network","Subnets@@@20"]],"x-badges":[{"color":"green","label":"Stable production version"}],"x-code-samples":[{"lang":"python","label":"Python","source":"'''\nFirst, install the latest release of Python wrapper: $ pip install ovh\n'''\nimport json\nimport ovh\n\n# Instantiate an OVH Client.\n# You can generate new credentials with full access to your account on\n# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)\nclient = ovh.Client(\n\tendpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)\n\tapplication_key='xxxxxxxxxx',    # Application Key\n\tapplication_secret='xxxxxxxxxx', # Application Secret\n\tconsumer_key='xxxxxxxxxx',       # Consumer Key\n)\n\nresult = client.get(\"/v2/publicCloud/project/{projectId}/network/{networkId}/subnet/{subnetId}\")\n\n# Pretty print\nprint(json.dumps(result, indent=4))"},{"lang":"php","label":"PHP","source":"<?php\n/**\n * First, download the latest release of PHP wrapper on github\n * And include this script into the folder with extracted files\n */\nrequire __DIR__ . '/vendor/autoload.php';\nuse \\Ovh\\Api;\n\n/**\n * Instantiate an OVH Client.\n * You can generate new credentials with full access to your account on\n * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)\n */\n$ovh = new Api('xxxxxxxxxx',  // Application Key\n               'xxxxxxxxxx',  // Application Secret\n               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)\n               'xxxxxxxxxx'); // Consumer Key\n\n$result = $ovh->get(\"/v2/publicCloud/project/{projectId}/network/{networkId}/subnet/{subnetId}\");\n\nprint_r($result);\n?>"}],"x-iam-actions":[{"name":"publicCloudProject:apiovh:network/subnet/get","required":true}],"x-response-identifier":"id"},"put":{"operationId":"editSubnet","summary":"Update a subnet","description":"Updates the subnet's name, description, DHCP, DNS nameservers, gateway or allocation pools. The CIDR is immutable.","security":[{"oAuth2AuthCode":[]}],"parameters":[{"in":"path","name":"networkId","description":"Network ID","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"projectId","description":"Project ID","required":true,"schema":{"type":"string"}},{"in":"path","name":"subnetId","description":"Subnet ID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/publicCloud.network.SubnetUpdate"},"examples":{"Update a subnet":{"value":{"checksum":"2ca2c085daf219b8fc232f7debf662d3","targetSpec":{"allocationPools":[{"end":"192.0.2.200","start":"192.0.2.10"}],"description":"Private subnet for backend instances","dhcpEnabled":true,"dnsNameservers":["1.1.1.1"],"gatewayIp":"192.0.2.1","name":"private-subnet-gra1"}},"summary":"Update the gateway, DNS nameservers and allocation pool of a subnet"}}}}},"responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/publicCloud.network.Subnet"}}}},"404":{"description":"Error 404 response","content":{"application/json":{"schema":{"type":"object","description":"Common error model","properties":{"class":{"type":"string","description":"Class of the error"},"message":{"type":"string","description":"Error message"}}},"examples":{"Client::NotFound::SubnetDoesNotExist":{"value":{"class":"Client::NotFound::SubnetDoesNotExist","message":"Subnet not found"}}}}}},"409":{"description":"Error 409 response","content":{"application/json":{"schema":{"type":"object","description":"Common error model","properties":{"class":{"type":"string","description":"Class of the error"},"message":{"type":"string","description":"Error message"}}},"examples":{"Client::Conflict::ChecksumMismatch":{"value":{"class":"Client::Conflict::ChecksumMismatch","message":"Checksum mismatch — a concurrent update was detected. Refresh the resource and retry"}},"Client::Conflict::ResourceInInvalidState":{"value":{"class":"Client::Conflict::ResourceInInvalidState","message":"Resource cannot be modified in its current state"}}}}}}},"tags":["Network"],"x-developer-hub-navigation":[["Public Cloud","Network","Subnets@@@50"]],"x-badges":[{"color":"green","label":"Stable production version"}],"x-code-samples":[{"lang":"python","label":"Python","source":"'''\nFirst, install the latest release of Python wrapper: $ pip install ovh\n'''\nimport json\nimport ovh\n\n# Instantiate an OVH Client.\n# You can generate new credentials with full access to your account on\n# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)\nclient = ovh.Client(\n\tendpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)\n\tapplication_key='xxxxxxxxxx',    # Application Key\n\tapplication_secret='xxxxxxxxxx', # Application Secret\n\tconsumer_key='xxxxxxxxxx',       # Consumer Key\n)\n\n# Request body type: publicCloud.network.SubnetUpdate\nresult = client.put(\"/v2/publicCloud/project/{projectId}/network/{networkId}/subnet/{subnetId}\",\n\tchecksum = None, # Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). (type: string, nullable)\n\ttargetSpec = None, # Desired target specification for the subnet (type: publicCloud.network.SubnetPutTargetSpec)\n)\n\n# Pretty print\nprint(json.dumps(result, indent=4))"},{"lang":"php","label":"PHP","source":"<?php\n/**\n * First, download the latest release of PHP wrapper on github\n * And include this script into the folder with extracted files\n */\nrequire __DIR__ . '/vendor/autoload.php';\nuse \\Ovh\\Api;\n\n/**\n * Instantiate an OVH Client.\n * You can generate new credentials with full access to your account on\n * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)\n */\n$ovh = new Api('xxxxxxxxxx',  // Application Key\n               'xxxxxxxxxx',  // Application Secret\n               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)\n               'xxxxxxxxxx'); // Consumer Key\n\n// Request body type: publicCloud.network.SubnetUpdate\n$result = $ovh->put(\"/v2/publicCloud/project/{projectId}/network/{networkId}/subnet/{subnetId}\", array(\n\tchecksum => null, // Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). (type: string, nullable)\n\ttargetSpec => null, // Desired target specification for the subnet (type: publicCloud.network.SubnetPutTargetSpec)\n));\n\nprint_r($result);\n?>"}],"x-iam-actions":[{"name":"publicCloudProject:apiovh:network/subnet/edit","required":true}]}}},"tags":[{"name":"Network","x-tag-expanded":false,"description":"Missing description"}]}
