scaleway-public-gateway/lib/Model/ScalewayVpcGwV2GatewayNetwork.php

791 lines
28 KiB
PHP
Raw Permalink Normal View History

2025-12-19 14:45:32 +01:00
<?php
/**
* ScalewayVpcGwV2GatewayNetwork
*
* 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 fo
*
* 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;
/**
* ScalewayVpcGwV2GatewayNetwork Class Doc Comment
*
* @category Class
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ScalewayVpcGwV2GatewayNetwork implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'scaleway.vpc_gw.v2.GatewayNetwork';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'created_at' => '\DateTime',
'updated_at' => '\DateTime',
'gateway_id' => 'string',
'private_network_id' => 'string',
'mac_address' => 'string',
'masquerade_enabled' => 'bool',
'status' => 'string',
'push_default_route' => 'bool',
'ipam_ip_id' => 'string',
'zone' => 'string'
];
/**
* 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 = [
'id' => null,
'created_at' => 'date-time',
'updated_at' => 'date-time',
'gateway_id' => null,
'private_network_id' => null,
'mac_address' => null,
'masquerade_enabled' => null,
'status' => null,
'push_default_route' => null,
'ipam_ip_id' => null,
'zone' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'created_at' => false,
'updated_at' => false,
'gateway_id' => false,
'private_network_id' => false,
'mac_address' => false,
'masquerade_enabled' => false,
'status' => false,
'push_default_route' => false,
'ipam_ip_id' => false,
'zone' => 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 = [
'id' => 'id',
'created_at' => 'created_at',
'updated_at' => 'updated_at',
'gateway_id' => 'gateway_id',
'private_network_id' => 'private_network_id',
'mac_address' => 'mac_address',
'masquerade_enabled' => 'masquerade_enabled',
'status' => 'status',
'push_default_route' => 'push_default_route',
'ipam_ip_id' => 'ipam_ip_id',
'zone' => 'zone'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt',
'gateway_id' => 'setGatewayId',
'private_network_id' => 'setPrivateNetworkId',
'mac_address' => 'setMacAddress',
'masquerade_enabled' => 'setMasqueradeEnabled',
'status' => 'setStatus',
'push_default_route' => 'setPushDefaultRoute',
'ipam_ip_id' => 'setIpamIpId',
'zone' => 'setZone'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt',
'gateway_id' => 'getGatewayId',
'private_network_id' => 'getPrivateNetworkId',
'mac_address' => 'getMacAddress',
'masquerade_enabled' => 'getMasqueradeEnabled',
'status' => 'getStatus',
'push_default_route' => 'getPushDefaultRoute',
'ipam_ip_id' => 'getIpamIpId',
'zone' => 'getZone'
];
/**
* 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;
}
public const STATUS_UNKNOWN_STATUS = 'unknown_status';
public const STATUS_CREATED = 'created';
public const STATUS_ATTACHING = 'attaching';
public const STATUS_CONFIGURING = 'configuring';
public const STATUS_READY = 'ready';
public const STATUS_DETACHING = 'detaching';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getStatusAllowableValues()
{
return [
self::STATUS_UNKNOWN_STATUS,
self::STATUS_CREATED,
self::STATUS_ATTACHING,
self::STATUS_CONFIGURING,
self::STATUS_READY,
self::STATUS_DETACHING,
];
}
/**
* 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('id', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
$this->setIfExists('gateway_id', $data ?? [], null);
$this->setIfExists('private_network_id', $data ?? [], null);
$this->setIfExists('mac_address', $data ?? [], null);
$this->setIfExists('masquerade_enabled', $data ?? [], null);
$this->setIfExists('status', $data ?? [], 'unknown_status');
$this->setIfExists('push_default_route', $data ?? [], null);
$this->setIfExists('ipam_ip_id', $data ?? [], null);
$this->setIfExists('zone', $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 = [];
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'status', must be one of '%s'",
$this->container['status'],
implode("', '", $allowedValues)
);
}
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 id
*
* @return string|null
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string|null $id ID of the Public Gateway-Private Network connection. (UUID format)
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime|null
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime|null $created_at Connection creation date. (RFC 3339 format)
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime|null
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime|null $updated_at Connection last modification date. (RFC 3339 format)
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Gets gateway_id
*
* @return string|null
*/
public function getGatewayId()
{
return $this->container['gateway_id'];
}
/**
* Sets gateway_id
*
* @param string|null $gateway_id ID of the connected Public Gateway. (UUID format)
*
* @return self
*/
public function setGatewayId($gateway_id)
{
if (is_null($gateway_id)) {
throw new \InvalidArgumentException('non-nullable gateway_id cannot be null');
}
$this->container['gateway_id'] = $gateway_id;
return $this;
}
/**
* Gets private_network_id
*
* @return string|null
*/
public function getPrivateNetworkId()
{
return $this->container['private_network_id'];
}
/**
* Sets private_network_id
*
* @param string|null $private_network_id ID of the connected Private Network. (UUID format)
*
* @return self
*/
public function setPrivateNetworkId($private_network_id)
{
if (is_null($private_network_id)) {
throw new \InvalidArgumentException('non-nullable private_network_id cannot be null');
}
$this->container['private_network_id'] = $private_network_id;
return $this;
}
/**
* Gets mac_address
*
* @return string|null
*/
public function getMacAddress()
{
return $this->container['mac_address'];
}
/**
* Sets mac_address
*
* @param string|null $mac_address MAC address of the gateway in the Private Network (if the gateway is up and running).
*
* @return self
*/
public function setMacAddress($mac_address)
{
if (is_null($mac_address)) {
throw new \InvalidArgumentException('non-nullable mac_address cannot be null');
}
$this->container['mac_address'] = $mac_address;
return $this;
}
/**
* Gets masquerade_enabled
*
* @return bool|null
*/
public function getMasqueradeEnabled()
{
return $this->container['masquerade_enabled'];
}
/**
* Sets masquerade_enabled
*
* @param bool|null $masquerade_enabled Defines whether the gateway masquerades traffic for this Private Network (Dynamic NAT).
*
* @return self
*/
public function setMasqueradeEnabled($masquerade_enabled)
{
if (is_null($masquerade_enabled)) {
throw new \InvalidArgumentException('non-nullable masquerade_enabled cannot be null');
}
$this->container['masquerade_enabled'] = $masquerade_enabled;
return $this;
}
/**
* Gets status
*
* @return string|null
*/
public function getStatus()
{
return $this->container['status'];
}
/**
* Sets status
*
* @param string|null $status Current status of the Public Gateway's connection to the Private Network.
*
* @return self
*/
public function setStatus($status)
{
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
}
$allowedValues = $this->getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
$status,
implode("', '", $allowedValues)
)
);
}
$this->container['status'] = $status;
return $this;
}
/**
* Gets push_default_route
*
* @return bool|null
*/
public function getPushDefaultRoute()
{
return $this->container['push_default_route'];
}
/**
* Sets push_default_route
*
* @param bool|null $push_default_route Enabling the default route also enables masquerading.
*
* @return self
*/
public function setPushDefaultRoute($push_default_route)
{
if (is_null($push_default_route)) {
throw new \InvalidArgumentException('non-nullable push_default_route cannot be null');
}
$this->container['push_default_route'] = $push_default_route;
return $this;
}
/**
* Gets ipam_ip_id
*
* @return string|null
*/
public function getIpamIpId()
{
return $this->container['ipam_ip_id'];
}
/**
* Sets ipam_ip_id
*
* @param string|null $ipam_ip_id Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. (UUID format)
*
* @return self
*/
public function setIpamIpId($ipam_ip_id)
{
if (is_null($ipam_ip_id)) {
throw new \InvalidArgumentException('non-nullable ipam_ip_id cannot be null');
}
$this->container['ipam_ip_id'] = $ipam_ip_id;
return $this;
}
/**
* Gets zone
*
* @return string|null
*/
public function getZone()
{
return $this->container['zone'];
}
/**
* Sets zone
*
* @param string|null $zone Zone of the GatewayNetwork connection.
*
* @return self
*/
public function setZone($zone)
{
if (is_null($zone)) {
throw new \InvalidArgumentException('non-nullable zone cannot be null');
}
$this->container['zone'] = $zone;
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));
}
}