'enableDhcp', 'network_id' => 'networkId', 'dns_nameservers' => 'dnsNameservers', 'allocation_pools' => 'allocationPools', 'host_routes' => 'hostRoutes', 'ip_version' => 'ipVersion', 'gateway_ip' => 'gatewayIp', 'tenant_id' => 'tenantId', ]; protected $resourceKey = 'subnet'; protected $resourcesKey = 'subnets'; /** * {@inheritdoc} */ public function retrieve() { $response = $this->execute($this->api->getSubnet(), ['id' => (string) $this->id]); $this->populateFromResponse($response); } /** * Creates multiple subnets in a single request. * * @param array $data {@see \OpenStack\Networking\v2\Api::postSubnets} * * @return Subnet[] */ public function bulkCreate(array $data): array { $response = $this->execute($this->api->postSubnets(), ['subnets' => $data]); return $this->extractMultipleInstances($response); } /** * {@inheritdoc} * * @param array $data {@see \OpenStack\Networking\v2\Api::postSubnet} */ public function create(array $data): Creatable { $response = $this->execute($this->api->postSubnet(), $data); return $this->populateFromResponse($response); } /** * {@inheritdoc} */ public function update() { $response = $this->executeWithState($this->api->putSubnet()); $this->populateFromResponse($response); } /** * {@inheritdoc} */ public function delete() { $this->executeWithState($this->api->deleteSubnet()); } /** * {@inheritdoc} */ protected function getAttrs(array $keys) { $output = parent::getAttrs($keys); if ('' === $this->gatewayIp) { $output['gatewayIp'] = null; } return $output; } }