hosterra/scaleway-public-gateways

Scaleway Public Gateways SDK.

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

pkg:composer/hosterra/scaleway-public-gateways

1.0.1 2025-12-19 13:49 UTC

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

  1. 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>\"
    
  2. 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\"   
    
  3. 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\"'\"
             }'
    
    ParameterDescriptionValid values
    typeThe 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-S
    nameA name of your choice for the Public GatewayAny string containing only alphanumeric characters and dashes, e.g. my-new-gateway.
    tagsA 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-tag
    project_idThe Scaleway Project ID to create the Public Gateway in.A valid Scaleway Project ID, e.g. f5fe13a0-b9c7-11ed-afa1-0242ac120002

    Note: Further parameters are available, but for the purposes of this quickstart we have included only the essentials. See the Create a Public Gateway endpoint documentation below for full details of all possible parameters.

  4. 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\"
    
  5. 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.

    ParameterDescriptionValid values
    gateway_idThe Public Gateway ID of an existing Public GatewayAny valid Public Gateway ID, e.g. b1b2edda-9364-422d-93f2-ad04e6a054dc
    private_network_idThe Private Network ID of an existing Private NetworkAny valid Private Network ID in the same Availability Zone as the Public Gateway, e.g. 548dbcc3-8b78-486f-a79a-c3f5a17642f9
    enable_masqueradeDefines whether the gateway should masquerade traffic for the attached Private Network (i.e. whether to enable dynamic NAT)A boolean value, e.g. true

    Further 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.

  6. 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)

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 running state. To check the current state of a Public Gateway, use the Get a Public Gateway endpoint to get information for your gateway: the status field 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:

NameAPI ID
Parisfr-par-1 fr-par-2
Amsterdamnl-ams-1 nl-ams-2 nl-ams-3
Warsawpl-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:

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

ClassMethodHTTP requestDescription
AllowedIPsApiaddBastionAllowedIPsPOST /vpc-gw/v2/zones/{zone}/gateways/{gateway_id}/bastion-allowed-ipsAdd allowed IP range to SSH bastion
AllowedIPsApideleteBastionAllowedIPsDELETE /vpc-gw/v2/zones/{zone}/gateways/{gateway_id}/bastion-allowed-ips/{ip_range}Delete allowed IP range from SSH bastion
AllowedIPsApisetBastionAllowedIPsPUT /vpc-gw/v2/zones/{zone}/gateways/{gateway_id}/bastion-allowed-ipsSet all IP ranges allowed for SSH bastion
GatewayNetworksApicreateGatewayNetworkPOST /vpc-gw/v2/zones/{zone}/gateway-networksAttach a Public Gateway to a Private Network
GatewayNetworksApideleteGatewayNetworkDELETE /vpc-gw/v2/zones/{zone}/gateway-networks/{gateway_network_id}Detach a Public Gateway from a Private Network
GatewayNetworksApigetGatewayNetworkGET /vpc-gw/v2/zones/{zone}/gateway-networks/{gateway_network_id}Get a Public Gateway connection to a Private Network
GatewayNetworksApilistGatewayNetworksGET /vpc-gw/v2/zones/{zone}/gateway-networksList Public Gateway connections to Private Networks
GatewayNetworksApiupdateGatewayNetworkPATCH /vpc-gw/v2/zones/{zone}/gateway-networks/{gateway_network_id}Update a Public Gateway's connection to a Private Network
GatewayTypesApilistGatewayTypesGET /vpc-gw/v2/zones/{zone}/gateway-typesList Public Gateway types
GatewaysApicreateGatewayPOST /vpc-gw/v2/zones/{zone}/gatewaysCreate a Public Gateway
GatewaysApideleteGatewayDELETE /vpc-gw/v2/zones/{zone}/gateways/{gateway_id}Delete a Public Gateway
GatewaysApigetGatewayGET /vpc-gw/v2/zones/{zone}/gateways/{gateway_id}Get a Public Gateway
GatewaysApilistGatewaysGET /vpc-gw/v2/zones/{zone}/gatewaysList Public Gateways
GatewaysApirefreshSSHKeysPOST /vpc-gw/v2/zones/{zone}/gateways/{gateway_id}/refresh-ssh-keysRefresh a Public Gateway's SSH keys
GatewaysApiupdateGatewayPATCH /vpc-gw/v2/zones/{zone}/gateways/{gateway_id}Update a Public Gateway
GatewaysApiupgradeGatewayPOST /vpc-gw/v2/zones/{zone}/gateways/{gateway_id}/upgradeUpgrade a Public Gateway to the latest version and/or to a different commercial offer type
IPsApicreateIPPOST /vpc-gw/v2/zones/{zone}/ipsReserve an IP
IPsApideleteIPDELETE /vpc-gw/v2/zones/{zone}/ips/{ip_id}Delete an IP
IPsApigetIPGET /vpc-gw/v2/zones/{zone}/ips/{ip_id}Get an IP
IPsApilistIPsGET /vpc-gw/v2/zones/{zone}/ipsList IPs
IPsApiupdateIPPATCH /vpc-gw/v2/zones/{zone}/ips/{ip_id}Update an IP
PATRulesApicreatePatRulePOST /vpc-gw/v2/zones/{zone}/pat-rulesCreate a PAT rule
PATRulesApideletePatRuleDELETE /vpc-gw/v2/zones/{zone}/pat-rules/{pat_rule_id}Delete a PAT rule
PATRulesApigetPatRuleGET /vpc-gw/v2/zones/{zone}/pat-rules/{pat_rule_id}Get a PAT rule
PATRulesApilistPatRulesGET /vpc-gw/v2/zones/{zone}/pat-rulesList PAT rules
PATRulesApisetPatRulesPUT /vpc-gw/v2/zones/{zone}/pat-rulesSet all PAT rules
PATRulesApiupdatePatRulePATCH /vpc-gw/v2/zones/{zone}/pat-rules/{pat_rule_id}Update a PAT rule

Models

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
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen