hosterra / scaleway-public-gateways
Scaleway Public Gateways SDK.
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- phpunit/phpunit: ^8.0 || ^9.0
This package is not auto-updated.
Last update: 2025-12-20 12:13:10 UTC
README
Scaleway Public Gateways are building blocks for your infrastructure on Scaleway's public cloud. They sit at the border of Private Networks and provide access to/from other networks or the Internet. As well as this, Public Gateways offer a host of managed features and services to facilitate the management of resources in your Private Network, including NAT to map private IP addresses in the Private Network to the public IP address of the Public Gateway.
(switchcolumn) To create and manage your Private Networks, check out the VPC API. (switchcolumn)
Concepts
Refer to our dedicated concepts page to find definitions of all terminology related to Public Gateways, including NAT, SSH bastion and more.
(switchcolumn) (switchcolumn)
Quickstart
Configure your environment variables.
This is an optional step that seeks to simplify your usage of the Public Gateways API.
export SCW_SECRET_KEY=\"<API secret key>\" export SCW_DEFAULT_ZONE=\"<Scaleway default Availability Zone>\" export SCW_PROJECT_ID=\"<Scaleway Project ID>\"Choose a Public Gateway type: Public Gateways come in different shapes and sizes, with different network capabilities and pricing. When you create your Public Gateway, you need to include the required Public Gateway type in the request. Use the following call to get a list of available Public Gateway offer types and their details:
curl -X GET \\ -H \"X-Auth-Token: $SCW_SECRET_KEY\" \\ -H \"Content-Type: application/json\" \\ \"https://api.scaleway.com/vpc-gw/v2/zones/$SCW_DEFAULT_ZONE/gateway-types\"Create a Public Gateway: run the following command to create a Public Gateway. You can customize the details in the payload (name, description, tags, etc) to your needs: use the information below to adjust the payload as necessary.
curl -X POST \\ -H \"X-Auth-Token: $SCW_SECRET_KEY\" \\ -H \"Content-Type: application/json\" \\ \"https://api.scaleway.com/vpc-gw/v2/zones/$SCW_DEFAULT_ZONE/gateways\" \\ -d '{ \"type\": \"VPC-GW-S\", \"name\": \"my-new-gateway\", \"tags\": [\"my-first-tag\", \"my-second-tag\"], \"project_id\": \"'\"$SCW_PROJECT_ID\"'\" }'Parameter Description Valid values type The type of Public Gateway (commercial offer type) to create. Use the Gateway Types endpoint to get a list of offer types. Any valid offer type string, e.g. VPC-GW-Sname A name of your choice for the Public Gateway Any string containing only alphanumeric characters and dashes, e.g. my-new-gateway.tags A list of tags to describe your Public Gateway. These can help you manage and filter your gateways. A list of alphanumeric strings, e.g. [\"my-first-tag,my-second-tagproject_id The Scaleway Project ID to create the Public Gateway in. A valid Scaleway Project ID, e.g. f5fe13a0-b9c7-11ed-afa1-0242ac120002Note: Further parameters are available, but for the purposes of this quickstart we have included only the essentials. See the
Create a Public Gatewayendpoint documentation below for full details of all possible parameters.Get a list of your Public Gateways: run the following command to get a list of all your Public Gateways.
curl -X GET \\ -H \"X-Auth-Token: $SCW_SECRET_KEY\" \\ -H \"Content-Type: application/json\" \\ \"https://api.scaleway.com/vpc-gw/v2/zones/$SCW_DEFAULT_ZONE/gateways\"Attach a Private Network to a Public Gateway: run the following command to attach a Private Network to your Public Gateway, and make all the Gateway's services such as NAT available to the Private Network. You can customize the details in the payload to your needs: use the information below to adjust the payload as necessary.
If you haven't created a Private Network yet, see the [Private Networks](https://www/scaleway.com/en/developers/api/vpc/) documentation to learn how to do so. Ensure you retain the ID of the Private Network.curl -X POST \\ -H \"X-Auth-Token: $SCW_SECRET_KEY\" \\ -H \"Content-Type: application/json\" \\ \"https://api.scaleway.com/vpc-gw/v2/zones/$SCW_DEFAULT_ZONE/gateway-networks\" \\ -d '{ \"gateway_id\": \"b1b2edda-9364-422d-93f2-ad04e6a054dc\", \"private_network_id\": \"548dbcc3-8b78-486f-a79a-c3f5a17642f9\", \"enable_masquerade\": true }'This configuration will set up the Public Gateway as a NAT gateway, masquerading traffic sent to it to the outer internet to provide internet access to resources in the Private Network.
Parameter Description Valid values gateway_id The Public Gateway ID of an existing Public Gateway Any valid Public Gateway ID, e.g. b1b2edda-9364-422d-93f2-ad04e6a054dcprivate_network_id The Private Network ID of an existing Private Network Any valid Private Network ID in the same Availability Zone as the Public Gateway, e.g. 548dbcc3-8b78-486f-a79a-c3f5a17642f9enable_masquerade Defines whether the gateway should masquerade traffic for the attached Private Network (i.e. whether to enable dynamic NAT) A boolean value, e.g. trueFurther parameters are available, but for the purposes of this quickstart we have included only the essentials. See the Attach a gateway to a Private Network documentation below for full details of all possible parameters.
Delete a Public Gateway: run the following call to delete your Public Gateway. Ensure that you replace
<PUBLIC-GATEWAY-ID>in the URL with the ID of the Public Gateway you want to delete.curl -X DELETE \\ -H \"X-Auth-Token: $SCW_SECRET_KEY\" \\ -H \"Content-Type: application/json\" \\ \"https://api.scaleway.com/vpc-gw/v2/zones/$SCW_DEFAULT_ZONE/gateways/<PUBLIC-GATEWAY-ID>\"The expected successful response is empty.
(switchcolumn)
- You have a Scaleway account
- You have created an API key and that the API key has sufficient IAM permissions to perform the actions described on this page
- You have installed
curl(switchcolumn)
Technical limitations
The following limitations apply to Public Gateways:
- A maximum of eight (8) Private Networks can be plugged into a single Public Gateway
- Note that the Public Gateway takes some time to start up, and actions on it are
impossible unless it is in the
runningstate. To check the current state of a Public Gateway, use the Get a Public Gateway endpoint to get information for your gateway: thestatusfield of the response will tell you if it is running or in another state. - For further information about Public Gateway limitations see our dedicated documentation.
Technical information
Availability Zones
Public Gateways can be deployed in the following Availability Zones:
| Name | API ID |
|---|---|
| Paris | fr-par-1 fr-par-2 |
| Amsterdam | nl-ams-1 nl-ams-2 nl-ams-3 |
| Warsaw | pl-waw-1 pl-waw-2 pl-waw-3 |
The Scaleway Public Gateways API is a zoned API, meaning that each call must specify in its path parameters the Availability Zone for the resources concerned by the call.
Going further
For more help using Scaleway Public Gateways, check out the following resources:
- Our main documentation
- The #public-gateway channel on our Slack Community
- Our support ticketing system.
Installation & Usage
Requirements
PHP 7.4 and later. Should also work with PHP 8.0.
Composer
To install the bindings via Composer, add the following to composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
}
],
"require": {
"GIT_USER_ID/GIT_REPO_ID": "*@dev"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php:
<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');
Getting Started
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: scaleway
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Auth-Token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Auth-Token', 'Bearer');
$apiInstance = new OpenAPI\Client\Api\AllowedIPsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$zone = 'zone_example'; // string | The zone you want to target
$gateway_id = 'gateway_id_example'; // string | ID of the gateway to add the allowed IP range to.
$add_bastion_allowed_ips_request = new \OpenAPI\Client\Model\AddBastionAllowedIPsRequest(); // \OpenAPI\Client\Model\AddBastionAllowedIPsRequest
try {
$result = $apiInstance->addBastionAllowedIPs($zone, $gateway_id, $add_bastion_allowed_ips_request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AllowedIPsApi->addBastionAllowedIPs: ', $e->getMessage(), PHP_EOL;
}
API Endpoints
All URIs are relative to https://api.scaleway.com
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AllowedIPsApi | addBastionAllowedIPs | POST /vpc-gw/v2/zones/{zone}/gateways/{gateway_id}/bastion-allowed-ips | Add allowed IP range to SSH bastion |
| AllowedIPsApi | deleteBastionAllowedIPs | DELETE /vpc-gw/v2/zones/{zone}/gateways/{gateway_id}/bastion-allowed-ips/{ip_range} | Delete allowed IP range from SSH bastion |
| AllowedIPsApi | setBastionAllowedIPs | PUT /vpc-gw/v2/zones/{zone}/gateways/{gateway_id}/bastion-allowed-ips | Set all IP ranges allowed for SSH bastion |
| GatewayNetworksApi | createGatewayNetwork | POST /vpc-gw/v2/zones/{zone}/gateway-networks | Attach a Public Gateway to a Private Network |
| GatewayNetworksApi | deleteGatewayNetwork | DELETE /vpc-gw/v2/zones/{zone}/gateway-networks/{gateway_network_id} | Detach a Public Gateway from a Private Network |
| GatewayNetworksApi | getGatewayNetwork | GET /vpc-gw/v2/zones/{zone}/gateway-networks/{gateway_network_id} | Get a Public Gateway connection to a Private Network |
| GatewayNetworksApi | listGatewayNetworks | GET /vpc-gw/v2/zones/{zone}/gateway-networks | List Public Gateway connections to Private Networks |
| GatewayNetworksApi | updateGatewayNetwork | PATCH /vpc-gw/v2/zones/{zone}/gateway-networks/{gateway_network_id} | Update a Public Gateway's connection to a Private Network |
| GatewayTypesApi | listGatewayTypes | GET /vpc-gw/v2/zones/{zone}/gateway-types | List Public Gateway types |
| GatewaysApi | createGateway | POST /vpc-gw/v2/zones/{zone}/gateways | Create a Public Gateway |
| GatewaysApi | deleteGateway | DELETE /vpc-gw/v2/zones/{zone}/gateways/{gateway_id} | Delete a Public Gateway |
| GatewaysApi | getGateway | GET /vpc-gw/v2/zones/{zone}/gateways/{gateway_id} | Get a Public Gateway |
| GatewaysApi | listGateways | GET /vpc-gw/v2/zones/{zone}/gateways | List Public Gateways |
| GatewaysApi | refreshSSHKeys | POST /vpc-gw/v2/zones/{zone}/gateways/{gateway_id}/refresh-ssh-keys | Refresh a Public Gateway's SSH keys |
| GatewaysApi | updateGateway | PATCH /vpc-gw/v2/zones/{zone}/gateways/{gateway_id} | Update a Public Gateway |
| GatewaysApi | upgradeGateway | POST /vpc-gw/v2/zones/{zone}/gateways/{gateway_id}/upgrade | Upgrade a Public Gateway to the latest version and/or to a different commercial offer type |
| IPsApi | createIP | POST /vpc-gw/v2/zones/{zone}/ips | Reserve an IP |
| IPsApi | deleteIP | DELETE /vpc-gw/v2/zones/{zone}/ips/{ip_id} | Delete an IP |
| IPsApi | getIP | GET /vpc-gw/v2/zones/{zone}/ips/{ip_id} | Get an IP |
| IPsApi | listIPs | GET /vpc-gw/v2/zones/{zone}/ips | List IPs |
| IPsApi | updateIP | PATCH /vpc-gw/v2/zones/{zone}/ips/{ip_id} | Update an IP |
| PATRulesApi | createPatRule | POST /vpc-gw/v2/zones/{zone}/pat-rules | Create a PAT rule |
| PATRulesApi | deletePatRule | DELETE /vpc-gw/v2/zones/{zone}/pat-rules/{pat_rule_id} | Delete a PAT rule |
| PATRulesApi | getPatRule | GET /vpc-gw/v2/zones/{zone}/pat-rules/{pat_rule_id} | Get a PAT rule |
| PATRulesApi | listPatRules | GET /vpc-gw/v2/zones/{zone}/pat-rules | List PAT rules |
| PATRulesApi | setPatRules | PUT /vpc-gw/v2/zones/{zone}/pat-rules | Set all PAT rules |
| PATRulesApi | updatePatRule | PATCH /vpc-gw/v2/zones/{zone}/pat-rules/{pat_rule_id} | Update a PAT rule |
Models
- AddBastionAllowedIPsRequest
- CreateGatewayNetworkRequest
- CreateGatewayRequest
- CreateIPRequest
- CreatePatRuleRequest
- ScalewayVpcGwV2AddBastionAllowedIPsResponse
- ScalewayVpcGwV2Gateway
- ScalewayVpcGwV2GatewayIpv4
- ScalewayVpcGwV2GatewayNetwork
- ScalewayVpcGwV2GatewayNetworkStatus
- ScalewayVpcGwV2GatewayStatus
- ScalewayVpcGwV2GatewayType
- ScalewayVpcGwV2IP
- ScalewayVpcGwV2ListGatewayNetworksResponse
- ScalewayVpcGwV2ListGatewayTypesResponse
- ScalewayVpcGwV2ListGatewaysResponse
- ScalewayVpcGwV2ListIPsResponse
- ScalewayVpcGwV2ListPatRulesResponse
- ScalewayVpcGwV2PatRule
- ScalewayVpcGwV2SetBastionAllowedIPsResponse
- ScalewayVpcGwV2SetPatRulesRequestRule
- ScalewayVpcGwV2SetPatRulesResponse
- SetBastionAllowedIPsRequest
- SetPatRulesRequest
- UpdateGatewayNetworkRequest
- UpdateGatewayRequest
- UpdateIPRequest
- UpdatePatRuleRequest
- UpgradeGatewayRequest
Authorization
Authentication schemes defined for the API:
scaleway
- Type: API key
- API key parameter name: X-Auth-Token
- Location: HTTP header
Tests
To run the tests, use:
composer install
vendor/bin/phpunit
Author
About this package
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
v2- Generator version:
7.11.0
- Generator version:
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen