1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Puerari\Cwp; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* @trait Autossl |
7
|
|
|
* @package Puerari\Cwp |
8
|
|
|
* @author Leandro Puerari <[email protected]> |
9
|
|
|
*/ |
10
|
|
|
trait Autossl |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @param string $user : Account username |
14
|
|
|
* @param string $name : Name of the domain or subdomain to generate the autossl |
15
|
|
|
* @return string|bool: false on failure, result on success (JSON / XML) |
16
|
|
|
* status -> OK |
17
|
|
|
* status -> Error, msj ->(array). |
18
|
|
|
*/ |
19
|
|
|
public function createAutoSsl(string $user, string $name) |
20
|
|
|
{ |
21
|
|
|
$this->data = compact('user', 'name'); |
|
|
|
|
22
|
|
|
$this->data['action'] = 'add'; |
23
|
|
|
$this->cwpuri = 'autossl'; |
|
|
|
|
24
|
|
|
return $this->execCurl(); |
|
|
|
|
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param string $user : Account user name |
29
|
|
|
* @param string $name : Name of the domain or subdomain to delete the autossl |
30
|
|
|
* @return string|bool: false on failure, result on success (JSON / XML) |
31
|
|
|
* status -> OK, msj -> Deleted Autossl |
32
|
|
|
* status -> Error, msj -> Error description |
33
|
|
|
*/ |
34
|
|
|
public function deleteAutoSsl(string $user, string $name) |
35
|
|
|
{ |
36
|
|
|
$this->data = compact('user', 'name'); |
|
|
|
|
37
|
|
|
$this->data['action'] = 'del'; |
38
|
|
|
$this->cwpuri = 'autossl'; |
|
|
|
|
39
|
|
|
return $this->execCurl(); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param string $user : Account username (If the user name is omitted, all AutoSSLs are listed) |
44
|
|
|
* @return string|bool: false on failure, result on success (JSON / XML) |
45
|
|
|
* status -> OK, msj -> Array with the different data of the certificate |
46
|
|
|
* status -> Error, msj -> Error description |
47
|
|
|
*/ |
48
|
|
|
public function listAutoSsl(string $user = null) |
49
|
|
|
{ |
50
|
|
|
$this->data = compact('user'); |
|
|
|
|
51
|
|
|
$this->data['action'] = 'list'; |
52
|
|
|
$this->cwpuri = 'autossl'; |
|
|
|
|
53
|
|
|
return $this->execCurl(); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @param string $user : Account user name |
58
|
|
|
* @param string $name : Name of the domain or subdomain to renew |
59
|
|
|
* @return string|bool: false on failure, result on success (JSON / XML) |
60
|
|
|
* status -> OK |
61
|
|
|
* status -> Error, msj -> Error description |
62
|
|
|
*/ |
63
|
|
|
public function renewAutoSsl(string $user, string $name) |
64
|
|
|
{ |
65
|
|
|
$this->data = compact('user', 'name'); |
|
|
|
|
66
|
|
|
$this->data['action'] = 'del'; |
67
|
|
|
$this->cwpuri = 'autossl'; |
|
|
|
|
68
|
|
|
return $this->execCurl(); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|