该软件包已被放弃,不再维护。未建议替代包。

为Laravel构建的简单Linode客户端,使用@JustSteveKing的laravel-transporter包

v2.4.0 2024-01-30 20:32 UTC

This package is auto-updated.

Last update: 2024-04-18 18:40:34 UTC


README

linode客户端

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status PHPStan Total Downloads

为Laravel构建的简单Linode客户端。

安装

您可以通过composer安装该包

composer require samuelmwangiw/linode

您可以使用以下命令发布和运行迁移

php artisan vendor:publish --provider="SamuelMwangiW\Linode\LinodeServiceProvider" --tag="linode-migrations"
php artisan migrate

您可以使用以下命令发布配置文件

php artisan vendor:publish --provider="SamuelMwangiW\Linode\LinodeServiceProvider" --tag="linode-config"

这是已发布配置文件的内容

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

变更日志

请参阅变更日志以获取有关最近更改的更多信息。

贡献

请参阅贡献指南以获取详细信息。

安全漏洞

请审查我们的安全策略以了解如何报告安全漏洞。

鸣谢

许可

MIT许可(MIT)。请参阅许可文件以获取更多信息。