545 lines
21 KiB
PHP
545 lines
21 KiB
PHP
<?php
|
|
/**
|
|
* UpdateGatewayRequest
|
|
*
|
|
* PHP version 7.4
|
|
*
|
|
* @category Class
|
|
* @package OpenAPI\Client
|
|
* @author OpenAPI Generator team
|
|
* @link https://openapi-generator.tech
|
|
*/
|
|
|
|
/**
|
|
* Public Gateways API
|
|
*
|
|
* 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) <Message type=\"tip\"> To create and manage your Private Networks, check out the [VPC API](https://www.scaleway.com/en/developers/api/vpc). </Message> (switchcolumn) ## Concepts Refer to our [dedicated concepts page](https://www.scaleway.com/en/docs/public-gateways/concepts/) to find definitions of all terminology related to Public Gateways, including NAT, SSH bastion and more. (switchcolumn) (switchcolumn) ## Quickstart 1. Configure your environment variables. <Message type=\"note\"> This is an optional step that seeks to simplify your usage of the Public Gateways API. </Message> ```bash 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: ```bash 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. ```bash 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-S` | | name | 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-tag` | | project_id | The 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. ```bash 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. <Message type=\"tip\"> 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. </Message> ```bash 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-ad04e6a054dc` | | private_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-c3f5a17642f9` | | enable_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. `true` | <Message type=\"note\"> 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](#path-gateway-networks-attach-a-public-gateway-to-a-private-network) documentation below for full details of all possible parameters. </Message> 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. ```bash 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) <Message type=\"requirement\"> - You have a [Scaleway account](https://console.scaleway.com/) - You have [created an API key](https://www.scaleway.com/en/docs/iam/how-to/create-api-keys/) and that the API key has sufficient [IAM permissions](https://www.scaleway.com/en/docs/iam/reference-content/permission-sets/) to perform the actions described on this page - You have [installed `curl`](https://curl.se/download.html) </Message> (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](#path-gateways-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](https://www.scaleway.com/en/docs/public-gateways/troubleshooting/gw-limitations/). ## 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](https://www.scaleway.com/en/docs/public-gateways/) - The #public-gateway channel on our [Slack Community](https://www.scaleway.com/en/docs/tutorials/scaleway-slack-community/) - Our [support ticketing system](https://www.scaleway.com/en/docs/account/how-to/open-a-support-ticket/).
|
|
*
|
|
* The version of the OpenAPI document: v2
|
|
* Generated by: https://openapi-generator.tech
|
|
* Generator version: 7.11.0
|
|
*/
|
|
|
|
/**
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
namespace OpenAPI\Client\Model;
|
|
|
|
use \ArrayAccess;
|
|
use \OpenAPI\Client\ObjectSerializer;
|
|
|
|
/**
|
|
* UpdateGatewayRequest Class Doc Comment
|
|
*
|
|
* @category Class
|
|
* @package OpenAPI\Client
|
|
* @author OpenAPI Generator team
|
|
* @link https://openapi-generator.tech
|
|
* @implements \ArrayAccess<string, mixed>
|
|
*/
|
|
class UpdateGatewayRequest implements ModelInterface, ArrayAccess, \JsonSerializable
|
|
{
|
|
public const DISCRIMINATOR = null;
|
|
|
|
/**
|
|
* The original name of the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected static $openAPIModelName = 'UpdateGateway_request';
|
|
|
|
/**
|
|
* Array of property to type mappings. Used for (de)serialization
|
|
*
|
|
* @var string[]
|
|
*/
|
|
protected static $openAPITypes = [
|
|
'name' => 'string',
|
|
'tags' => 'string[]',
|
|
'enable_bastion' => 'bool',
|
|
'bastion_port' => 'int',
|
|
'enable_smtp' => 'bool'
|
|
];
|
|
|
|
/**
|
|
* Array of property to format mappings. Used for (de)serialization
|
|
*
|
|
* @var string[]
|
|
* @phpstan-var array<string, string|null>
|
|
* @psalm-var array<string, string|null>
|
|
*/
|
|
protected static $openAPIFormats = [
|
|
'name' => null,
|
|
'tags' => null,
|
|
'enable_bastion' => null,
|
|
'bastion_port' => 'uint32',
|
|
'enable_smtp' => null
|
|
];
|
|
|
|
/**
|
|
* Array of nullable properties. Used for (de)serialization
|
|
*
|
|
* @var boolean[]
|
|
*/
|
|
protected static array $openAPINullables = [
|
|
'name' => false,
|
|
'tags' => false,
|
|
'enable_bastion' => false,
|
|
'bastion_port' => false,
|
|
'enable_smtp' => false
|
|
];
|
|
|
|
/**
|
|
* If a nullable field gets set to null, insert it here
|
|
*
|
|
* @var boolean[]
|
|
*/
|
|
protected array $openAPINullablesSetToNull = [];
|
|
|
|
/**
|
|
* Array of property to type mappings. Used for (de)serialization
|
|
*
|
|
* @return array
|
|
*/
|
|
public static function openAPITypes()
|
|
{
|
|
return self::$openAPITypes;
|
|
}
|
|
|
|
/**
|
|
* Array of property to format mappings. Used for (de)serialization
|
|
*
|
|
* @return array
|
|
*/
|
|
public static function openAPIFormats()
|
|
{
|
|
return self::$openAPIFormats;
|
|
}
|
|
|
|
/**
|
|
* Array of nullable properties
|
|
*
|
|
* @return array
|
|
*/
|
|
protected static function openAPINullables(): array
|
|
{
|
|
return self::$openAPINullables;
|
|
}
|
|
|
|
/**
|
|
* Array of nullable field names deliberately set to null
|
|
*
|
|
* @return boolean[]
|
|
*/
|
|
private function getOpenAPINullablesSetToNull(): array
|
|
{
|
|
return $this->openAPINullablesSetToNull;
|
|
}
|
|
|
|
/**
|
|
* Setter - Array of nullable field names deliberately set to null
|
|
*
|
|
* @param boolean[] $openAPINullablesSetToNull
|
|
*/
|
|
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
|
|
{
|
|
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
|
|
}
|
|
|
|
/**
|
|
* Checks if a property is nullable
|
|
*
|
|
* @param string $property
|
|
* @return bool
|
|
*/
|
|
public static function isNullable(string $property): bool
|
|
{
|
|
return self::openAPINullables()[$property] ?? false;
|
|
}
|
|
|
|
/**
|
|
* Checks if a nullable property is set to null.
|
|
*
|
|
* @param string $property
|
|
* @return bool
|
|
*/
|
|
public function isNullableSetToNull(string $property): bool
|
|
{
|
|
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
|
}
|
|
|
|
/**
|
|
* Array of attributes where the key is the local name,
|
|
* and the value is the original name
|
|
*
|
|
* @var string[]
|
|
*/
|
|
protected static $attributeMap = [
|
|
'name' => 'name',
|
|
'tags' => 'tags',
|
|
'enable_bastion' => 'enable_bastion',
|
|
'bastion_port' => 'bastion_port',
|
|
'enable_smtp' => 'enable_smtp'
|
|
];
|
|
|
|
/**
|
|
* Array of attributes to setter functions (for deserialization of responses)
|
|
*
|
|
* @var string[]
|
|
*/
|
|
protected static $setters = [
|
|
'name' => 'setName',
|
|
'tags' => 'setTags',
|
|
'enable_bastion' => 'setEnableBastion',
|
|
'bastion_port' => 'setBastionPort',
|
|
'enable_smtp' => 'setEnableSmtp'
|
|
];
|
|
|
|
/**
|
|
* Array of attributes to getter functions (for serialization of requests)
|
|
*
|
|
* @var string[]
|
|
*/
|
|
protected static $getters = [
|
|
'name' => 'getName',
|
|
'tags' => 'getTags',
|
|
'enable_bastion' => 'getEnableBastion',
|
|
'bastion_port' => 'getBastionPort',
|
|
'enable_smtp' => 'getEnableSmtp'
|
|
];
|
|
|
|
/**
|
|
* Array of attributes where the key is the local name,
|
|
* and the value is the original name
|
|
*
|
|
* @return array
|
|
*/
|
|
public static function attributeMap()
|
|
{
|
|
return self::$attributeMap;
|
|
}
|
|
|
|
/**
|
|
* Array of attributes to setter functions (for deserialization of responses)
|
|
*
|
|
* @return array
|
|
*/
|
|
public static function setters()
|
|
{
|
|
return self::$setters;
|
|
}
|
|
|
|
/**
|
|
* Array of attributes to getter functions (for serialization of requests)
|
|
*
|
|
* @return array
|
|
*/
|
|
public static function getters()
|
|
{
|
|
return self::$getters;
|
|
}
|
|
|
|
/**
|
|
* The original name of the model.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getModelName()
|
|
{
|
|
return self::$openAPIModelName;
|
|
}
|
|
|
|
|
|
/**
|
|
* Associative array for storing property values
|
|
*
|
|
* @var mixed[]
|
|
*/
|
|
protected $container = [];
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* @param mixed[]|null $data Associated array of property values
|
|
* initializing the model
|
|
*/
|
|
public function __construct(?array $data = null)
|
|
{
|
|
$this->setIfExists('name', $data ?? [], null);
|
|
$this->setIfExists('tags', $data ?? [], null);
|
|
$this->setIfExists('enable_bastion', $data ?? [], null);
|
|
$this->setIfExists('bastion_port', $data ?? [], null);
|
|
$this->setIfExists('enable_smtp', $data ?? [], null);
|
|
}
|
|
|
|
/**
|
|
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
|
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
|
* $this->openAPINullablesSetToNull array
|
|
*
|
|
* @param string $variableName
|
|
* @param array $fields
|
|
* @param mixed $defaultValue
|
|
*/
|
|
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
|
{
|
|
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
|
$this->openAPINullablesSetToNull[] = $variableName;
|
|
}
|
|
|
|
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
|
}
|
|
|
|
/**
|
|
* Show all the invalid properties with reasons.
|
|
*
|
|
* @return array invalid properties with reasons
|
|
*/
|
|
public function listInvalidProperties()
|
|
{
|
|
$invalidProperties = [];
|
|
|
|
return $invalidProperties;
|
|
}
|
|
|
|
/**
|
|
* Validate all the properties in the model
|
|
* return true if all passed
|
|
*
|
|
* @return bool True if all properties are valid
|
|
*/
|
|
public function valid()
|
|
{
|
|
return count($this->listInvalidProperties()) === 0;
|
|
}
|
|
|
|
|
|
/**
|
|
* Gets name
|
|
*
|
|
* @return string|null
|
|
*/
|
|
public function getName()
|
|
{
|
|
return $this->container['name'];
|
|
}
|
|
|
|
/**
|
|
* Sets name
|
|
*
|
|
* @param string|null $name Name for the gateway.
|
|
*
|
|
* @return self
|
|
*/
|
|
public function setName($name)
|
|
{
|
|
if (is_null($name)) {
|
|
throw new \InvalidArgumentException('non-nullable name cannot be null');
|
|
}
|
|
$this->container['name'] = $name;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Gets tags
|
|
*
|
|
* @return string[]|null
|
|
*/
|
|
public function getTags()
|
|
{
|
|
return $this->container['tags'];
|
|
}
|
|
|
|
/**
|
|
* Sets tags
|
|
*
|
|
* @param string[]|null $tags Tags for the gateway.
|
|
*
|
|
* @return self
|
|
*/
|
|
public function setTags($tags)
|
|
{
|
|
if (is_null($tags)) {
|
|
throw new \InvalidArgumentException('non-nullable tags cannot be null');
|
|
}
|
|
$this->container['tags'] = $tags;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Gets enable_bastion
|
|
*
|
|
* @return bool|null
|
|
*/
|
|
public function getEnableBastion()
|
|
{
|
|
return $this->container['enable_bastion'];
|
|
}
|
|
|
|
/**
|
|
* Sets enable_bastion
|
|
*
|
|
* @param bool|null $enable_bastion Defines whether SSH bastion should be enabled the gateway.
|
|
*
|
|
* @return self
|
|
*/
|
|
public function setEnableBastion($enable_bastion)
|
|
{
|
|
if (is_null($enable_bastion)) {
|
|
throw new \InvalidArgumentException('non-nullable enable_bastion cannot be null');
|
|
}
|
|
$this->container['enable_bastion'] = $enable_bastion;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Gets bastion_port
|
|
*
|
|
* @return int|null
|
|
*/
|
|
public function getBastionPort()
|
|
{
|
|
return $this->container['bastion_port'];
|
|
}
|
|
|
|
/**
|
|
* Sets bastion_port
|
|
*
|
|
* @param int|null $bastion_port Port of the SSH bastion.
|
|
*
|
|
* @return self
|
|
*/
|
|
public function setBastionPort($bastion_port)
|
|
{
|
|
if (is_null($bastion_port)) {
|
|
throw new \InvalidArgumentException('non-nullable bastion_port cannot be null');
|
|
}
|
|
$this->container['bastion_port'] = $bastion_port;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Gets enable_smtp
|
|
*
|
|
* @return bool|null
|
|
*/
|
|
public function getEnableSmtp()
|
|
{
|
|
return $this->container['enable_smtp'];
|
|
}
|
|
|
|
/**
|
|
* Sets enable_smtp
|
|
*
|
|
* @param bool|null $enable_smtp Defines whether SMTP traffic should be allowed to pass through the gateway.
|
|
*
|
|
* @return self
|
|
*/
|
|
public function setEnableSmtp($enable_smtp)
|
|
{
|
|
if (is_null($enable_smtp)) {
|
|
throw new \InvalidArgumentException('non-nullable enable_smtp cannot be null');
|
|
}
|
|
$this->container['enable_smtp'] = $enable_smtp;
|
|
|
|
return $this;
|
|
}
|
|
/**
|
|
* Returns true if offset exists. False otherwise.
|
|
*
|
|
* @param integer $offset Offset
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function offsetExists($offset): bool
|
|
{
|
|
return isset($this->container[$offset]);
|
|
}
|
|
|
|
/**
|
|
* Gets offset.
|
|
*
|
|
* @param integer $offset Offset
|
|
*
|
|
* @return mixed|null
|
|
*/
|
|
#[\ReturnTypeWillChange]
|
|
public function offsetGet($offset)
|
|
{
|
|
return $this->container[$offset] ?? null;
|
|
}
|
|
|
|
/**
|
|
* Sets value based on offset.
|
|
*
|
|
* @param int|null $offset Offset
|
|
* @param mixed $value Value to be set
|
|
*
|
|
* @return void
|
|
*/
|
|
public function offsetSet($offset, $value): void
|
|
{
|
|
if (is_null($offset)) {
|
|
$this->container[] = $value;
|
|
} else {
|
|
$this->container[$offset] = $value;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Unsets offset.
|
|
*
|
|
* @param integer $offset Offset
|
|
*
|
|
* @return void
|
|
*/
|
|
public function offsetUnset($offset): void
|
|
{
|
|
unset($this->container[$offset]);
|
|
}
|
|
|
|
/**
|
|
* Serializes the object to a value that can be serialized natively by json_encode().
|
|
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
|
*
|
|
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
|
* of any type other than a resource.
|
|
*/
|
|
#[\ReturnTypeWillChange]
|
|
public function jsonSerialize()
|
|
{
|
|
return ObjectSerializer::sanitizeForSerialization($this);
|
|
}
|
|
|
|
/**
|
|
* Gets the string presentation of the object
|
|
*
|
|
* @return string
|
|
*/
|
|
public function __toString()
|
|
{
|
|
return json_encode(
|
|
ObjectSerializer::sanitizeForSerialization($this),
|
|
JSON_PRETTY_PRINT
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Gets a header-safe presentation of the object
|
|
*
|
|
* @return string
|
|
*/
|
|
public function toHeaderValue()
|
|
{
|
|
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
|
}
|
|
}
|
|
|
|
|