hnhdigital-os/php-linode-api

View on GitHub
src/endpoints/Managed/Services.php

Summary

Maintainability
A
1 hr
Test Coverage
<?php

namespace HnhDigital\LinodeApi\Managed;

/*
 * 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 Services class.
 *
 * This file is automatically generated.
 *
 * @link https://developers.linode.com/api/v4#tag/Managed-Services
 *
 * @author Rocco Howard <rocco@hnh.digital>
 */
class Services extends Base
{
    /**
     * Endpoint.
     *
     * @var string
     */
    protected $endpoint = 'managed/services';

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

    /**
     * Returns a paginated list of Managed Services on your Account. These are the services Linode Managed is monitoring and
     * will report and attempt to resolve issues with.
     *
     * @link https://developers.linode.com/api/v4#operation/getManagedServices
     *
     * @return array
     */
    public function get()
    {
        return $this->apiSearch($this->endpoint, ['class' => 'Managed\Service', 'parameters' => ['id']]);
    }

    /**
     * Creates a Managed Service. Linode Managed will being monitoring this service and reporting and attempting to resolve any
     * Issues.
     *
     * @param array $optional
     *                        - [id=null] (integer) This Service's unique ID.
     *                        - [status=null] (string) The current status of this Service.
     *                        - [service_type=null] (string) How this Service is monitored.
     *                        - [label=null] (string) The label for this Service. This is for display purposes
     *                        only.
     *                        - [address=null] (string) The URL at which this Service is monitored.
     *                        - [timeout=null] (integer) How long to wait, in seconds, for a response before
     *                        considering the Service to be down.
     *                        - [body=null] (string) What to expect to find in the response body for the
     *                        Service to be considered up.
     *                        - [consultation_group=null] (string) The group of ManagedContacts who should be notified or
     *                        consulted with when an Issue is detected.
     *                        - [notes=null] (string) Any information relevant to the Service that Linode
     *                        special forces should know when attempting to resolve
     *                        Issues.
     *                        - [region=null] (string) The Region in which this Service is located. This is
     *                        required if address is a private IP, and may not be set
     *                        otherwise.
     *                        - [credentials=[]] (array) An array of ManagedCredential IDs that should be used
     *                        when attempting to resolve issues with this Service.
     *                        - [created=null] (string) When this Managed Service was created.
     *                        - [updated=null] (string) When this Managed Service was last updated.
     *
     * @link https://developers.linode.com/api/v4#operation/createManagedService
     *
     * @return mixed
     */
    public function create($optional = [])
    {
        return $this->apiCall('post', '', ['json' => array_merge([
        ], $optional)]);
    }
}