A Simple Linode client built for Laravel.
You can install the package via composer:
composer require samuelmwangiw/linode
You can publish and run the migrations with:
php artisan vendor:publish --provider="SamuelMwangiW\Linode\LinodeServiceProvider" --tag="linode-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --provider="SamuelMwangiW\Linode\LinodeServiceProvider" --tag="linode-config"
This is the contents of the published config file:
return [
'endpoint' => env('LINODE_API_ENDPOINT', 'https://api.linode.com/v4/'),
'token' => env('LINODE_PERSONAL_ACCESS_TOKEN'),
];
@todo.
use SamuelMwangiW\Linode\Facades\Linode;
// Get your account details
Linode::account();
// List created Firewalls
Linode::firewall()->list();
// Get a Firewall rule
Linode::firewall()->show(123456);
// Delete a Firewall and its rules
Linode::firewall()->destroy(123456);
// Get all rules attached to a Firewall
Linode::firewall()->rules()->show(123456);
// Get available images
Linode::images()->list();
$image = [
'disk_id' => 67890123,
'label' => 'backup_disk',
'description' => 'Created in tests, delete',
];
// Create image from disk
Linode::images()->create($disk);
// show an image
Linode::images()->show(12345678);
// Delete a user created image
Linode::images()->destroy(12345678);
// List of available instances
Linode::instance()->list();
// Get an instance details
Linode::instance()->show(654321);
// Get list of disks attached to an instance
Linode::instance()->disks(654321);
$instance = [
'authorized_keys' => ['ssh-rsa yourverysecuresshpublickeywhoseprivatekeywillneverbeleakedontheinternetandfilepermissionsarepermanentlysetto0600='],
'authorized_users' => ['unicorn'],
'region' => 'eu-west',
'image' => 'linode/ubuntu22.04',
'private_ip' => true,
'label' => 'unicorn-worker-42',
'root_pass' => fake()->password(),
'type' => 'g6-nanode-1',
'watchdog_enabled' => true,
'tags' => ['workers', 'to-the-moon'],
];
// Create a linode instance
Linode::instance()->create($instance);
// Update an instance details
Linode::instance()
->update(654321, ['label'=> 'mars-rover','tags'=>['mars-colony']]);
// Clone a Linode instance
Linode::instance()
->clone(654321,['label'=>'mars-rover-02','tags'=>['test']]);
// Nuke 💣 an instance
Linode::instance()->destroy(654321);
// Shutdown an instance
Linode::instance()->shutdown(654321);
// List available Linode plans
Linode::billing()->plans();
// List of available regions
Linode::region()->list();
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.