File tree 3 files changed +79
-0
lines changed
3 files changed +79
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All Notable changes to `php-lxd` will be documented in this file.
4
4
5
5
Updates should follow the [ Keep a CHANGELOG] ( http://keepachangelog.com/ ) principles.
6
6
7
+ # [ 0.19.0]
8
+
9
+ ## Added
10
+ - Support for the warnings API
7
11
8
12
# [ 0.18.2]
9
13
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Opensaucesystems \Lxd \Endpoint ;
4
+
5
+ use Opensaucesystems \Lxd \Exception \InvalidEndpointException ;
6
+
7
+ class Warnings extends AbstractEndpoint
8
+ {
9
+ protected function getEndpoint ()
10
+ {
11
+ return '/warnings/ ' ;
12
+ }
13
+
14
+ public function all (string $ project = null , int $ recursion = 1 )
15
+ {
16
+ $ config = [
17
+ "recursion " =>1
18
+ ];
19
+
20
+ if (!empty ($ project )) {
21
+ $ config ["project " ] = $ project ;
22
+ }
23
+
24
+
25
+ return $ this ->get ($ this ->getEndpoint (), $ config );
26
+ }
27
+
28
+ public function info (string $ uuid )
29
+ {
30
+ return $ this ->get ($ this ->getEndpoint () . $ uuid );
31
+ }
32
+
33
+ public function remove (string $ uuid )
34
+ {
35
+ return $ this ->delete ($ this ->getEndpoint () . $ uuid );
36
+ }
37
+
38
+ public function __get ($ endpoint )
39
+ {
40
+ $ class = __NAMESPACE__ .'\\Warnings \\' .ucfirst ($ endpoint );
41
+
42
+ if (class_exists ($ class )) {
43
+ return new $ class ($ this ->client );
44
+ } else {
45
+ throw new InvalidEndpointException (
46
+ 'Endpoint ' .$ class .', not implemented. '
47
+ );
48
+ }
49
+ }
50
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Opensaucesystems \Lxd \Endpoint \Warnings ;
4
+
5
+ use Opensaucesystems \Lxd \Endpoint \AbstractEndpoint ;
6
+
7
+ class Status extends AbstractEndpoint
8
+ {
9
+ protected function getEndpoint ()
10
+ {
11
+ return '/warnings/ ' ;
12
+ }
13
+
14
+ public function new (string $ uuid )
15
+ {
16
+ $ data = ["status " =>"new " ];
17
+ return $ this ->put ($ this ->getEndpoint () . $ uuid , $ data );
18
+ }
19
+
20
+ public function acknowledge (string $ uuid )
21
+ {
22
+ $ data = ["status " =>"acknowledged " ];
23
+ return $ this ->put ($ this ->getEndpoint () . $ uuid , $ data );
24
+ }
25
+ }
You can’t perform that action at this time.
0 commit comments