SDK for working with vSphere automation API. You can use it to manage ESXI and vCenter powered machines.
vCenterApplianceVersion | status | description |
---|---|---|
7.0 |
supported | |
6.7 |
supported | some of api like ConsoleTicket is not working more information |
6.5 | supported |
It's super easy to use, just run the below command:
composer require masoudniki/vcenter
just pass argument to the VmwareApiClient
and create an instace:
require "vendor/autoload.php";
$vmware=new \FNDEV\vShpare\VmwareApiClient(
"127.0.0.1",
[
"username"=>"admin",
"password"=>"admin"
],
"443",
);
only the domain name without any protocol and slash charcher or ip address is acceptable
You have two options for authentication:
you can pass username and password in array for getting session id
[
'username'=>'local@admin',
'password'=>'123456789'
]
increasing session timeout in vCenter and pass directly the session id
[
'Vmware-Api-Session-Id'=>$sessionId
]
For the initiation & first time use you can pass username and password and then get the session with getSessionId() method on VmwareApiClient
require "vendor/autoload.php";
$vmware=new \FNDEV\vShpare\VmwareApiClient(
"127.0.0.1",
"443",
[
"username"=>"admin",
"password"=>"admin"
],
);
$vmware->getSessionId();
the port of vCenterAppliance application default value is: 443
if you are using self signed certificate pass the path of certificate or set true otherwise if you dont want to check certificate set false
if you are running vCenterAppliance on HTTP protocol set http or if you are running it on HTTPS set https
The main path of REST API default value is: "/rest/vcenter"
The authetication URL for creating Vmware-Api-Session-Id default value is:"/rest/com/vmware/cis/session"
You can create your guzzle http client and set its configuartion then pass it to VmwaareApiClient
The MIT License (MIT). Please see License File for more information.
If you find an issue or have a better way to do something, feel free to open an issue, or a pull request. If you use VmwareApiClient in your open source project, create a pull request to provide its URL as a sample application in the README.md file.
If you discover any security-related issues, please email masoud.niki79@gmail.com
instead of using the issue tracker.
- Add other APIs to the SDK
- Writing more tests
- Creating request class for methods that send options like createVm
- Refactoring bad practice