hnhdigital-os/php-linode-api

View on GitHub
src/endpoints/Images.php

Summary

Maintainability
A
1 hr
Test Coverage
<?php

namespace HnhDigital\LinodeApi;

/*
 * This file is part of the PHP Linode API.
 *
 * (c) H&H|Digital <hello@hnh.digital>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

use HnhDigital\LinodeApi\Foundation\Base;

/**
 * This is the Images class.
 *
 * This file is automatically generated.
 *
 * @link https://developers.linode.com/api/v4#tag/Images
 *
 * @author Rocco Howard <rocco@hnh.digital>
 */
class Images extends Base
{
    /**
     * Endpoint.
     *
     * @var string
     */
    protected $endpoint = 'images';

    /**
     * Constructor.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Returns a paginated list of Images.
     *
     * - Calling this endpoint without authentication returns all public Images.
     * - Authentication is required to return a combined paginated list of all public and
     *   your private Images.
     *
     * @link https://developers.linode.com/api/v4#operation/getImages
     *
     * @return array
     */
    public function get()
    {
        return $this->apiSearch($this->endpoint, ['class' => 'Image', 'parameters' => ['id']]);
    }

    /**
     * Creates a private gold-master Image from a Linode Disk. There is no additional charge to store Images for Linode users.
     * Images are limited to three per Account.
     *
     * @param array $optional
     *                        - [id=null] (string) The unique ID of this Image.
     *                        - [label=null] (string) A short description of the Image. Labels cannot contain
     *                        special characters.
     *                        - [created=null] (string) When this Image was created.
     *                        - [created_by=null] (string) The name of the User who created this Image.
     *                        - [deprecated=null] (boolean) Whether or not this Image is deprecated. Will only be
     *                        True for deprecated public Images.
     *                        - [description=null] (string) An optional detailed description of this Image.
     *                        - [is_public=null] (boolean) True if the Image is public.
     *                        - [size=null] (integer) The minimum size this Image needs to deploy. Size is in
     *                        MB.
     *                        - [type=null] (string) How the Image was created. "Manual" Images can be
     *                        created at any time. "Automatic" images are created
     *                        automatically from a deleted Linode.
     *                        - [vendor=null] (string) The upstream distribution vendor. `None` for private
     *                        Images.
     *                        - [disk_id=null] (integer) The ID of the Linode Disk that this Image will be
     *                        created from.
     *
     * @link https://developers.linode.com/api/v4#operation/createImage
     *
     * @return mixed
     */
    public function create($optional = [])
    {
        return $this->apiCall('post', '', ['json' => array_merge([
        ], $optional)]);
    }
}