@@ -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 | |