scaleway-instance/lib/Model/ScalewayInstanceV1Dashboard.php

889 lines
37 KiB
PHP
Raw Permalink Normal View History

2025-02-24 15:03:32 +01:00
<?php
/**
* ScalewayInstanceV1Dashboard
*
* PHP version 7.4
*
* @category Class
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* Instance API
*
* Scaleway Instances are virtual machines in the cloud. Different [Instance types](https://www.scaleway.com/en/docs/compute/instances/reference-content/choosing-instance-type/) offer different technical specifications in terms of vCPU, RAM, bandwidth and storage. Once you have created your Instance and installed your image of choice (e.g. an operating system), you can [connect to your Instance via SSH](https://www.scaleway.com/en/docs/compute/instances/how-to/connect-to-instance/) to use it as you wish. When you are done using the Instance, you can delete it from your account. (switchcolumn) <Message type=\"tip\"> To retrieve information about the different [images](#path-images) available to install on Scaleway Instances, check out our [Marketplace API](https://www.scaleway.com/en/developers/api/marketplace). </Message> (switchcolumn) ## Concepts Refer to our [dedicated concepts page](https://www.scaleway.com/en/docs/compute/instances/concepts/) to find definitions of all concepts and terminology related to Instances. (switchcolumn) (switchcolumn) ## Quickstart 1. Configure your environment variables <Message type=\"note\"> This is an optional step that seeks to simplify your usage of the Instances API. See [Availability Zones](#availability-zones) below for help choosing an Availability Zone. You can find your Project ID in the [Scaleway console](https://console.scaleway.com/project/settings). </Message> ```bash export SCW_SECRET_KEY=\"<API secret key>\" export SCW_DEFAULT_ZONE=\"<Scaleway Availability Zone>\" export SCW_PROJECT_ID=\"<Scaleway Project ID>\" ``` 2. **Create an Instance**: Run the following command to create an Instance. You can customize the details in the payload (name, description, type, 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/instance/v1/zones/$SCW_DEFAULT_ZONE/servers\" \\ -d '{ \"name\": \"my-new-instance\", \"project\": \"'\"$SCW_PROJECT_ID\"'\", \"commercial_type\": \"GP1-S\", \"image\": \"ubuntu_noble\", \"enable_ipv6\": true, \"volumes\": { \"0\":{ \"size\": 300000000000, \"volume_type\": \"l_ssd\" } } }' ``` | Parameter | Description | Valid values | | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `name` | A name of your choice for the Instance (string)
*
* The version of the OpenAPI document: v1
* 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;
/**
* ScalewayInstanceV1Dashboard Class Doc Comment
*
* @category Class
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ScalewayInstanceV1Dashboard implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'scaleway.instance.v1.Dashboard';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'volumes_count' => 'int',
'running_servers_count' => 'int',
'servers_by_types' => '\OpenAPI\Client\Model\ScalewayInstanceV1DashboardServersByTypes',
'images_count' => 'int',
'snapshots_count' => 'int',
'servers_count' => 'int',
'ips_count' => 'int',
'security_groups_count' => 'int',
'ips_unused' => 'int',
'volumes_l_ssd_count' => 'int',
'volumes_b_ssd_count' => 'int',
'volumes_l_ssd_total_size' => 'int',
'volumes_b_ssd_total_size' => 'int',
'private_nics_count' => 'int',
'placement_groups_count' => 'int'
];
/**
* 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 = [
'volumes_count' => 'uint32',
'running_servers_count' => 'uint32',
'servers_by_types' => null,
'images_count' => 'uint32',
'snapshots_count' => 'uint32',
'servers_count' => 'uint32',
'ips_count' => 'uint32',
'security_groups_count' => 'uint32',
'ips_unused' => 'uint32',
'volumes_l_ssd_count' => 'uint32',
'volumes_b_ssd_count' => 'uint32',
'volumes_l_ssd_total_size' => 'uint64',
'volumes_b_ssd_total_size' => 'uint64',
'private_nics_count' => 'uint32',
'placement_groups_count' => 'uint32'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'volumes_count' => false,
'running_servers_count' => false,
'servers_by_types' => false,
'images_count' => false,
'snapshots_count' => false,
'servers_count' => false,
'ips_count' => false,
'security_groups_count' => false,
'ips_unused' => false,
'volumes_l_ssd_count' => false,
'volumes_b_ssd_count' => false,
'volumes_l_ssd_total_size' => false,
'volumes_b_ssd_total_size' => false,
'private_nics_count' => false,
'placement_groups_count' => 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 = [
'volumes_count' => 'volumes_count',
'running_servers_count' => 'running_servers_count',
'servers_by_types' => 'servers_by_types',
'images_count' => 'images_count',
'snapshots_count' => 'snapshots_count',
'servers_count' => 'servers_count',
'ips_count' => 'ips_count',
'security_groups_count' => 'security_groups_count',
'ips_unused' => 'ips_unused',
'volumes_l_ssd_count' => 'volumes_l_ssd_count',
'volumes_b_ssd_count' => 'volumes_b_ssd_count',
'volumes_l_ssd_total_size' => 'volumes_l_ssd_total_size',
'volumes_b_ssd_total_size' => 'volumes_b_ssd_total_size',
'private_nics_count' => 'private_nics_count',
'placement_groups_count' => 'placement_groups_count'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'volumes_count' => 'setVolumesCount',
'running_servers_count' => 'setRunningServersCount',
'servers_by_types' => 'setServersByTypes',
'images_count' => 'setImagesCount',
'snapshots_count' => 'setSnapshotsCount',
'servers_count' => 'setServersCount',
'ips_count' => 'setIpsCount',
'security_groups_count' => 'setSecurityGroupsCount',
'ips_unused' => 'setIpsUnused',
'volumes_l_ssd_count' => 'setVolumesLSsdCount',
'volumes_b_ssd_count' => 'setVolumesBSsdCount',
'volumes_l_ssd_total_size' => 'setVolumesLSsdTotalSize',
'volumes_b_ssd_total_size' => 'setVolumesBSsdTotalSize',
'private_nics_count' => 'setPrivateNicsCount',
'placement_groups_count' => 'setPlacementGroupsCount'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'volumes_count' => 'getVolumesCount',
'running_servers_count' => 'getRunningServersCount',
'servers_by_types' => 'getServersByTypes',
'images_count' => 'getImagesCount',
'snapshots_count' => 'getSnapshotsCount',
'servers_count' => 'getServersCount',
'ips_count' => 'getIpsCount',
'security_groups_count' => 'getSecurityGroupsCount',
'ips_unused' => 'getIpsUnused',
'volumes_l_ssd_count' => 'getVolumesLSsdCount',
'volumes_b_ssd_count' => 'getVolumesBSsdCount',
'volumes_l_ssd_total_size' => 'getVolumesLSsdTotalSize',
'volumes_b_ssd_total_size' => 'getVolumesBSsdTotalSize',
'private_nics_count' => 'getPrivateNicsCount',
'placement_groups_count' => 'getPlacementGroupsCount'
];
/**
* 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('volumes_count', $data ?? [], null);
$this->setIfExists('running_servers_count', $data ?? [], null);
$this->setIfExists('servers_by_types', $data ?? [], null);
$this->setIfExists('images_count', $data ?? [], null);
$this->setIfExists('snapshots_count', $data ?? [], null);
$this->setIfExists('servers_count', $data ?? [], null);
$this->setIfExists('ips_count', $data ?? [], null);
$this->setIfExists('security_groups_count', $data ?? [], null);
$this->setIfExists('ips_unused', $data ?? [], null);
$this->setIfExists('volumes_l_ssd_count', $data ?? [], null);
$this->setIfExists('volumes_b_ssd_count', $data ?? [], null);
$this->setIfExists('volumes_l_ssd_total_size', $data ?? [], null);
$this->setIfExists('volumes_b_ssd_total_size', $data ?? [], null);
$this->setIfExists('private_nics_count', $data ?? [], null);
$this->setIfExists('placement_groups_count', $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 volumes_count
*
* @return int|null
*/
public function getVolumesCount()
{
return $this->container['volumes_count'];
}
/**
* Sets volumes_count
*
* @param int|null $volumes_count volumes_count
*
* @return self
*/
public function setVolumesCount($volumes_count)
{
if (is_null($volumes_count)) {
throw new \InvalidArgumentException('non-nullable volumes_count cannot be null');
}
$this->container['volumes_count'] = $volumes_count;
return $this;
}
/**
* Gets running_servers_count
*
* @return int|null
*/
public function getRunningServersCount()
{
return $this->container['running_servers_count'];
}
/**
* Sets running_servers_count
*
* @param int|null $running_servers_count running_servers_count
*
* @return self
*/
public function setRunningServersCount($running_servers_count)
{
if (is_null($running_servers_count)) {
throw new \InvalidArgumentException('non-nullable running_servers_count cannot be null');
}
$this->container['running_servers_count'] = $running_servers_count;
return $this;
}
/**
* Gets servers_by_types
*
* @return \OpenAPI\Client\Model\ScalewayInstanceV1DashboardServersByTypes|null
*/
public function getServersByTypes()
{
return $this->container['servers_by_types'];
}
/**
* Sets servers_by_types
*
* @param \OpenAPI\Client\Model\ScalewayInstanceV1DashboardServersByTypes|null $servers_by_types servers_by_types
*
* @return self
*/
public function setServersByTypes($servers_by_types)
{
if (is_null($servers_by_types)) {
throw new \InvalidArgumentException('non-nullable servers_by_types cannot be null');
}
$this->container['servers_by_types'] = $servers_by_types;
return $this;
}
/**
* Gets images_count
*
* @return int|null
*/
public function getImagesCount()
{
return $this->container['images_count'];
}
/**
* Sets images_count
*
* @param int|null $images_count images_count
*
* @return self
*/
public function setImagesCount($images_count)
{
if (is_null($images_count)) {
throw new \InvalidArgumentException('non-nullable images_count cannot be null');
}
$this->container['images_count'] = $images_count;
return $this;
}
/**
* Gets snapshots_count
*
* @return int|null
*/
public function getSnapshotsCount()
{
return $this->container['snapshots_count'];
}
/**
* Sets snapshots_count
*
* @param int|null $snapshots_count snapshots_count
*
* @return self
*/
public function setSnapshotsCount($snapshots_count)
{
if (is_null($snapshots_count)) {
throw new \InvalidArgumentException('non-nullable snapshots_count cannot be null');
}
$this->container['snapshots_count'] = $snapshots_count;
return $this;
}
/**
* Gets servers_count
*
* @return int|null
*/
public function getServersCount()
{
return $this->container['servers_count'];
}
/**
* Sets servers_count
*
* @param int|null $servers_count servers_count
*
* @return self
*/
public function setServersCount($servers_count)
{
if (is_null($servers_count)) {
throw new \InvalidArgumentException('non-nullable servers_count cannot be null');
}
$this->container['servers_count'] = $servers_count;
return $this;
}
/**
* Gets ips_count
*
* @return int|null
*/
public function getIpsCount()
{
return $this->container['ips_count'];
}
/**
* Sets ips_count
*
* @param int|null $ips_count ips_count
*
* @return self
*/
public function setIpsCount($ips_count)
{
if (is_null($ips_count)) {
throw new \InvalidArgumentException('non-nullable ips_count cannot be null');
}
$this->container['ips_count'] = $ips_count;
return $this;
}
/**
* Gets security_groups_count
*
* @return int|null
*/
public function getSecurityGroupsCount()
{
return $this->container['security_groups_count'];
}
/**
* Sets security_groups_count
*
* @param int|null $security_groups_count security_groups_count
*
* @return self
*/
public function setSecurityGroupsCount($security_groups_count)
{
if (is_null($security_groups_count)) {
throw new \InvalidArgumentException('non-nullable security_groups_count cannot be null');
}
$this->container['security_groups_count'] = $security_groups_count;
return $this;
}
/**
* Gets ips_unused
*
* @return int|null
*/
public function getIpsUnused()
{
return $this->container['ips_unused'];
}
/**
* Sets ips_unused
*
* @param int|null $ips_unused ips_unused
*
* @return self
*/
public function setIpsUnused($ips_unused)
{
if (is_null($ips_unused)) {
throw new \InvalidArgumentException('non-nullable ips_unused cannot be null');
}
$this->container['ips_unused'] = $ips_unused;
return $this;
}
/**
* Gets volumes_l_ssd_count
*
* @return int|null
*/
public function getVolumesLSsdCount()
{
return $this->container['volumes_l_ssd_count'];
}
/**
* Sets volumes_l_ssd_count
*
* @param int|null $volumes_l_ssd_count volumes_l_ssd_count
*
* @return self
*/
public function setVolumesLSsdCount($volumes_l_ssd_count)
{
if (is_null($volumes_l_ssd_count)) {
throw new \InvalidArgumentException('non-nullable volumes_l_ssd_count cannot be null');
}
$this->container['volumes_l_ssd_count'] = $volumes_l_ssd_count;
return $this;
}
/**
* Gets volumes_b_ssd_count
*
* @return int|null
* @deprecated
*/
public function getVolumesBSsdCount()
{
return $this->container['volumes_b_ssd_count'];
}
/**
* Sets volumes_b_ssd_count
*
* @param int|null $volumes_b_ssd_count volumes_b_ssd_count
*
* @return self
* @deprecated
*/
public function setVolumesBSsdCount($volumes_b_ssd_count)
{
if (is_null($volumes_b_ssd_count)) {
throw new \InvalidArgumentException('non-nullable volumes_b_ssd_count cannot be null');
}
$this->container['volumes_b_ssd_count'] = $volumes_b_ssd_count;
return $this;
}
/**
* Gets volumes_l_ssd_total_size
*
* @return int|null
*/
public function getVolumesLSsdTotalSize()
{
return $this->container['volumes_l_ssd_total_size'];
}
/**
* Sets volumes_l_ssd_total_size
*
* @param int|null $volumes_l_ssd_total_size (in bytes)
*
* @return self
*/
public function setVolumesLSsdTotalSize($volumes_l_ssd_total_size)
{
if (is_null($volumes_l_ssd_total_size)) {
throw new \InvalidArgumentException('non-nullable volumes_l_ssd_total_size cannot be null');
}
$this->container['volumes_l_ssd_total_size'] = $volumes_l_ssd_total_size;
return $this;
}
/**
* Gets volumes_b_ssd_total_size
*
* @return int|null
* @deprecated
*/
public function getVolumesBSsdTotalSize()
{
return $this->container['volumes_b_ssd_total_size'];
}
/**
* Sets volumes_b_ssd_total_size
*
* @param int|null $volumes_b_ssd_total_size (in bytes)
*
* @return self
* @deprecated
*/
public function setVolumesBSsdTotalSize($volumes_b_ssd_total_size)
{
if (is_null($volumes_b_ssd_total_size)) {
throw new \InvalidArgumentException('non-nullable volumes_b_ssd_total_size cannot be null');
}
$this->container['volumes_b_ssd_total_size'] = $volumes_b_ssd_total_size;
return $this;
}
/**
* Gets private_nics_count
*
* @return int|null
*/
public function getPrivateNicsCount()
{
return $this->container['private_nics_count'];
}
/**
* Sets private_nics_count
*
* @param int|null $private_nics_count private_nics_count
*
* @return self
*/
public function setPrivateNicsCount($private_nics_count)
{
if (is_null($private_nics_count)) {
throw new \InvalidArgumentException('non-nullable private_nics_count cannot be null');
}
$this->container['private_nics_count'] = $private_nics_count;
return $this;
}
/**
* Gets placement_groups_count
*
* @return int|null
*/
public function getPlacementGroupsCount()
{
return $this->container['placement_groups_count'];
}
/**
* Sets placement_groups_count
*
* @param int|null $placement_groups_count placement_groups_count
*
* @return self
*/
public function setPlacementGroupsCount($placement_groups_count)
{
if (is_null($placement_groups_count)) {
throw new \InvalidArgumentException('non-nullable placement_groups_count cannot be null');
}
$this->container['placement_groups_count'] = $placement_groups_count;
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));
}
}