@@ -12,21 +12,21 @@ discard block |
||
12 | 12 | { |
13 | 13 | $this->HttpClient=$HttpClient; |
14 | 14 | } |
15 | - public function all(){ |
|
15 | + public function all() { |
|
16 | 16 | return ApiResponse::BodyResponse($this->HttpClient->get("com/vmware/cis/tagging/category")); |
17 | 17 | } |
18 | - public function get($category_id){ |
|
18 | + public function get($category_id) { |
|
19 | 19 | return ApiResponse::BodyResponse($this->HttpClient->get("com/vmware/cis/tagging/category/id:$category_id")); |
20 | 20 | } |
21 | - public function delete($category_id){ |
|
21 | + public function delete($category_id) { |
|
22 | 22 | return ApiResponse::BodyResponse($this->HttpClient->delete("com/vmware/cis/tagging/category/id:$category_id")); |
23 | 23 | } |
24 | - public function update($category_id,array $config){ |
|
25 | - return ApiResponse::BodyResponse($this->HttpClient->patch("com/vmware/cis/tagging/category/id:$category_id",[ |
|
24 | + public function update($category_id, array $config) { |
|
25 | + return ApiResponse::BodyResponse($this->HttpClient->patch("com/vmware/cis/tagging/category/id:$category_id", [ |
|
26 | 26 | "json"=>$config |
27 | 27 | ])); |
28 | 28 | } |
29 | - public function addToUsedBy($category_id,$entity){ |
|
29 | + public function addToUsedBy($category_id, $entity) { |
|
30 | 30 | return ApiResponse::BodyResponse($this->HttpClient->post("com/vmware/cis/tagging/category/id:$category_id?~action=add-to-used-by", |
31 | 31 | [ |
32 | 32 | "json"=> |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | ] |
37 | 37 | )); |
38 | 38 | } |
39 | - public function removeUsedToBy($category_id,$entity){ |
|
39 | + public function removeUsedToBy($category_id, $entity) { |
|
40 | 40 | return ApiResponse::BodyResponse($this->HttpClient->post("com/vmware/cis/tagging/category/id:$category_id?~action=remove-from-used-by", |
41 | 41 | [ |
42 | 42 | "json"=> |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ] |
47 | 47 | )); |
48 | 48 | } |
49 | - public function revokePropagatingPermissions($category_id){ |
|
49 | + public function revokePropagatingPermissions($category_id) { |
|
50 | 50 | return ApiResponse::BodyResponse($this->HttpClient->post("com/vmware/cis/tagging/category/id:$category_id?~action=revoke-propagating-permissions")); |
51 | 51 | } |
52 | 52 | } |
53 | 53 | \ No newline at end of file |
@@ -12,21 +12,21 @@ discard block |
||
12 | 12 | { |
13 | 13 | $this->HttpClient=$HttpClient; |
14 | 14 | } |
15 | - public function all(){ |
|
15 | + public function all() { |
|
16 | 16 | return ApiResponse::BodyResponse($this->HttpClient->get("com/vmware/cis/tagging/tag")); |
17 | 17 | } |
18 | - public function get($tag_id){ |
|
18 | + public function get($tag_id) { |
|
19 | 19 | return ApiResponse::BodyResponse($this->HttpClient->get("com/vmware/cis/tagging/tag/id:$tag_id")); |
20 | 20 | } |
21 | - public function delete($tag_id){ |
|
21 | + public function delete($tag_id) { |
|
22 | 22 | return ApiResponse::BodyResponse($this->HttpClient->delete("com/vmware/cis/tagging/tag/id:$tag_id")); |
23 | 23 | } |
24 | - public function update($tag_id,array $config){ |
|
25 | - return ApiResponse::BodyResponse($this->HttpClient->patch("com/vmware/cis/tagging/tag/id:$tag_id",[ |
|
24 | + public function update($tag_id, array $config) { |
|
25 | + return ApiResponse::BodyResponse($this->HttpClient->patch("com/vmware/cis/tagging/tag/id:$tag_id", [ |
|
26 | 26 | "json"=>$config |
27 | 27 | ])); |
28 | 28 | } |
29 | - public function allTagsForCategory($category_id){ |
|
29 | + public function allTagsForCategory($category_id) { |
|
30 | 30 | return ApiResponse::BodyResponse($this->HttpClient->post("com/vmware/cis/tagging/tag?~action=list-tags-for-category", |
31 | 31 | [ |
32 | 32 | "json"=> |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | ] |
37 | 37 | )); |
38 | 38 | } |
39 | - public function addToUsedBy($tag_id,$entity){ |
|
39 | + public function addToUsedBy($tag_id, $entity) { |
|
40 | 40 | return ApiResponse::BodyResponse($this->HttpClient->post("com/vmware/cis/tagging/tag/id:$tag_id?~action=add-to-used-by", |
41 | 41 | [ |
42 | 42 | "json"=> |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ] |
47 | 47 | )); |
48 | 48 | } |
49 | - public function removeUsedToBy($tag_id,$entity){ |
|
49 | + public function removeUsedToBy($tag_id, $entity) { |
|
50 | 50 | return ApiResponse::BodyResponse($this->HttpClient->post("com/vmware/cis/tagging/tag/id:$tag_id?~action=remove-from-used-by", |
51 | 51 | [ |
52 | 52 | "json"=> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ] |
57 | 57 | )); |
58 | 58 | } |
59 | - public function revokePropagatingPermissions($tag_id){ |
|
59 | + public function revokePropagatingPermissions($tag_id) { |
|
60 | 60 | return ApiResponse::BodyResponse($this->HttpClient->post("com/vmware/cis/tagging/tag/id:$tag_id?~action=revoke-propagating-permissions")); |
61 | 61 | } |
62 | 62 | } |
63 | 63 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | class Assigning extends InitClass |
12 | 12 | { |
13 | 13 | use MOID; |
14 | - public function attachToVirtualMachine($tag_id,$moid=null){ |
|
14 | + public function attachToVirtualMachine($tag_id, $moid=null) { |
|
15 | 15 | return ApiResponse::BodyResponse($this->HttpClient->post("com/vmware/cis/tagging/tag-association/id:$tag_id?~action=attach", |
16 | 16 | [ |
17 | 17 | "json"=> |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | ] |
26 | 26 | )); |
27 | 27 | } |
28 | - public function detachFromVirtualMachine($tag_id,$moid=null){ |
|
28 | + public function detachFromVirtualMachine($tag_id, $moid=null) { |
|
29 | 29 | return ApiResponse::BodyResponse($this->HttpClient->post("com/vmware/cis/tagging/tag-association/id:$tag_id?~action=attach", |
30 | 30 | [ |
31 | 31 | "json"=> |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ] |
40 | 40 | )); |
41 | 41 | } |
42 | - public function listAttachedTagsToVirtualMachine($moid=null){ |
|
42 | + public function listAttachedTagsToVirtualMachine($moid=null) { |
|
43 | 43 | return ApiResponse::BodyResponse($this->HttpClient->post("com/vmware/cis/tagging/tag-association?~action=list-attached-tags", |
44 | 44 | [ |
45 | 45 | "json"=> |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | ] |
54 | 54 | )); |
55 | 55 | } |
56 | - public function listAttachableTagsToVirtualMachine($moid=null){ |
|
56 | + public function listAttachableTagsToVirtualMachine($moid=null) { |
|
57 | 57 | return ApiResponse::BodyResponse($this->HttpClient->post("com/vmware/cis/tagging/tag-association?~action=list-attachable-tags", |
58 | 58 | [ |
59 | 59 | "json"=> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | ] |
68 | 68 | )); |
69 | 69 | } |
70 | - public function listAttachedObjectsToATag($tag_id){ |
|
70 | + public function listAttachedObjectsToATag($tag_id) { |
|
71 | 71 | return ApiResponse::BodyResponse($this->HttpClient->post("com/vmware/cis/tagging/tag-association/id:$tag_id?~action=list-attached-objects")); |
72 | 72 | } |
73 | 73 | } |
74 | 74 | \ No newline at end of file |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use FNDEV\vShpare\Auth\SessionHandler; |
6 | 6 | use FNDEV\vShpare\Client\GuzzleClient; |
7 | 7 | use \GuzzleHttp\Client; |
8 | - class VmwareApiClient{ |
|
8 | + class VmwareApiClient { |
|
9 | 9 | public $host; |
10 | 10 | public $credential; |
11 | 11 | public $HttpClient; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public $authUrl; |
15 | 15 | public $protocol; |
16 | 16 | public $port; |
17 | - public function __construct($host,array $credential,$port=443,$ssl=false,$protocol="https",$baseurl="/rest/",$authurl="/rest/com/vmware/cis/session",?Client $client=null) |
|
17 | + public function __construct($host, array $credential, $port=443, $ssl=false, $protocol="https", $baseurl="/rest/", $authurl="/rest/com/vmware/cis/session", ?Client $client=null) |
|
18 | 18 | { |
19 | 19 | $this->host=$host; |
20 | 20 | $this->port=$port; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $this->baseUrl=$baseurl; |
24 | 24 | $this->authUrl=$authurl; |
25 | 25 | $this->protocol=$protocol; |
26 | - $this->HttpClient=$client??new GuzzleClient($this); |
|
26 | + $this->HttpClient=$client ?? new GuzzleClient($this); |
|
27 | 27 | } |
28 | 28 | public function vm():VM{ |
29 | 29 | return new Api\VM\VM($this->HttpClient); |
@@ -31,25 +31,25 @@ discard block |
||
31 | 31 | public function tagging():Tagging{ |
32 | 32 | return new Tagging($this->HttpClient); |
33 | 33 | } |
34 | - public function getHttpClient(){ |
|
34 | + public function getHttpClient() { |
|
35 | 35 | return $this->HttpClient; |
36 | 36 | } |
37 | - public function setHttpClient(Client $client){ |
|
37 | + public function setHttpClient(Client $client) { |
|
38 | 38 | $this->HttpClient=$client; |
39 | 39 | } |
40 | - public function getSessionId(){ |
|
40 | + public function getSessionId() { |
|
41 | 41 | return SessionHandler::getSession($this); |
42 | 42 | } |
43 | - public function getBaseUrl(){ |
|
44 | - return $this->addScheme($this->host.":".$this->port."/".trim($this->baseUrl,"/")."/",$this->protocol); |
|
43 | + public function getBaseUrl() { |
|
44 | + return $this->addScheme($this->host.":".$this->port."/".trim($this->baseUrl, "/")."/", $this->protocol); |
|
45 | 45 | } |
46 | - public function getAuthUrl(){ |
|
47 | - return $this->addScheme($this->host.":".$this->port."/".trim($this->authUrl,"/"),$this->protocol); |
|
46 | + public function getAuthUrl() { |
|
47 | + return $this->addScheme($this->host.":".$this->port."/".trim($this->authUrl, "/"), $this->protocol); |
|
48 | 48 | } |
49 | - function addScheme($url, $scheme = 'http') |
|
49 | + function addScheme($url, $scheme='http') |
|
50 | 50 | { |
51 | - return parse_url($url, PHP_URL_SCHEME) === null ? |
|
52 | - $scheme."://" . $url : $url; |
|
51 | + return parse_url($url, PHP_URL_SCHEME)===null ? |
|
52 | + $scheme."://".$url : $url; |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 |