-
Notifications
You must be signed in to change notification settings - Fork 8
FloatingIps::create
Danny Li edited this page Feb 4, 2018
·
1 revision
Parameter | Type | Description |
---|---|---|
$config |
Configs\FloatingIp |
Floating IP configuration |
<?php
use Exploriment\HetznerCloud;
$ip = HetznerCloud\FloatingIps::create($config);
echo $ip->getIp();
Creating a new floating IP requires the Configs\FloatingIp
config object, an example below:
<?php
use Exploriment\HetznerCloud;
/**
* new floating IP configuration
*
* You may also set the type immediately like so:
* $config = new HetznerCloud\Configs\FloatingIp('ipv4');
*/
$config = new HetznerCloud\Configs\FloatingIp();
// set the type of the floating IP. ipv4/ipv6 (required)
$config->setType('ipv4');
/**
* set the home location of the floating IP (semi-required)
* either server or home_location must be provided
*
* $location can be either the location ID, location name or the Location object
* @see https://github.com/Exploriment/hcloud-php/wiki/resources:-locations#location-object
*/
$config->setHomeLocation($location);
/**
* assign the floating IP to a server (semi-required)
* either server or home_location must be provided
*
* $server can be either the server ID or the Server object
* @see https://github.com/Exploriment/hcloud-php/wiki/resources:-servers#server-object
*/
$config->setServer($server);
// give the floating IP a description (optional)
$config->setDescription('My amazing floating IP');
/**
* Your configuration for the floating IP is now ready.
*/
by Exploriment.io
- README.md
-
Resources introduction
- Actions
-
Servers
::findAction
::create
::getMetrics
::rename
::start
-
::powerOn
(alias) ::reboot
-
::restart
(alias) ::reset
::shutdown
-
::stop
(alias) ::powerOff
::resetPassword
::enableRescue
::disableRescue
::createImage
::rebuild
::changeType
::enableBackups
::disableBackups
::attachIso
::detachIso
::changeDnsPtr
::changeProtection
::requestConsole
::delete
- FloatingIps
- SshKeys
- ServerTypes
- Locations
- Datacenters
- Images
- ISOs