src/endpoints/Managed/Service.php
<?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 Service class.
*
* This file is automatically generated.
*
* @link https://developers.linode.com/api/v4#tag/Managed-Services
*
* @author Rocco Howard <rocco@hnh.digital>
*/
class Service extends Base
{
/**
* Endpoint.
*
* @var string
*/
protected $endpoint = 'managed/services/%s';
/**
* Service Id.
*
* @var int
*/
protected $service_id;
/**
* This model is fillable.
*
* @var bool
*/
protected $fillable = true;
/**
* This model's method that provides the data to fill it.
*
* @var string
*/
protected $fill_method = 'get';
/**
* Constructor.
*
* @return void
*/
public function __construct($service_id, $fill = [])
{
$this->service_id = $service_id;
parent::__construct($service_id, $fill);
}
/**
* Returns information about a single Managed Service on your Account.
*
* @link https://developers.linode.com/api/v4#operation/getManagedService
*
* @return array
*/
public function get()
{
return $this->apiCall('get', '', [], ['auto-fill' => true]);
}
/**
* Updates information about a Managed Service.
*
* @param int $service_id The ID of the Managed Service to access.
*
* @link https://developers.linode.com/api/v4#operation/updateManagedService
*
* @return void
*/
public function update($optional = [])
{
return $this->apiCall('put', '', ['json' => $this->getDirty($optional)]);
}
/**
* Temporarily disables monitoring of a Managed Service.
*
* @param int $service_id The ID of the Managed Service to disable.
*
* @link https://developers.linode.com/api/v4#operation/disableManagedService
*
* @return mixed
*/
public function disable($optional = [])
{
return $this->apiCall('post', '/disable', ['json' => array_merge([
'service_id' => $service_id,
], $optional)]);
}
/**
* Enables monitoring of a Managed Service.
*
* @param int $service_id The ID of the Managed Service to enable.
*
* @link https://developers.linode.com/api/v4#operation/enableManagedService
*
* @return mixed
*/
public function enable($optional = [])
{
return $this->apiCall('post', '/enable', ['json' => array_merge([
'service_id' => $service_id,
], $optional)]);
}
/**
* Deletes a Managed Service. This service will no longer be monitored by Linode Managed.
*
* @param int $service_id The ID of the Managed Service to access.
*
* @link https://developers.linode.com/api/v4#operation/deleteManagedService
*
* @return void
*/
public function delete()
{
return $this->apiCall('delete', '');
}
}