src/endpoints/Managed/Credential.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 Credential class.
*
* This file is automatically generated.
*
* @link https://developers.linode.com/api/v4#tag/Managed-Credentials
*
* @author Rocco Howard <rocco@hnh.digital>
*/
class Credential extends Base
{
/**
* Endpoint.
*
* @var string
*/
protected $endpoint = 'managed/credentials/%s';
/**
* Credential Id.
*
* @var int
*/
protected $credential_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($credential_id, $fill = [])
{
$this->credential_id = $credential_id;
parent::__construct($credential_id, $fill);
}
/**
* Returns a single Managed Credential.
*
* @link https://developers.linode.com/api/v4#operation/getManagedCredential
*
* @return array
*/
public function get()
{
return $this->apiCall('get', '', [], ['auto-fill' => true]);
}
/**
* Updates information about a Managed Credential.
*
* @param int $credential_id The ID of the Credential to access.
*
* @link https://developers.linode.com/api/v4#operation/updateManagedCredential
*
* @return void
*/
public function update($optional = [])
{
return $this->apiCall('put', '', ['json' => $this->getDirty($optional)]);
}
/**
* Deletes a Managed Credential. Linode special forces will no longer have access to this Credential when attempting to
* resolve issues.
*
* @param int $credential_id The ID of the Credential to access.
*
* @link https://developers.linode.com/api/v4#operation/deleteManagedCredential
*
* @return mixed
*/
public function delete($optional = [])
{
return $this->apiCall('post', '/revoke', ['json' => array_merge([
'credential_id' => $credential_id,
], $optional)]);
}
}