-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from sumitAgrawal007/master
Binding and samples and ReadMe update for vsphere 7.0 GA
- Loading branch information
Showing
60 changed files
with
3,722 additions
and
1,146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ JDK 1.8. | |
|
||
## Supported OnPrem vCenter Releases: | ||
|
||
vCenter 6.0, 6.5, 6.7, 6.7U1, 6.7U2, 6.7U3 | ||
vCenter 6.0, 6.5, 6.7, 6.7U1, 6.7U2, 6.7U3, 7.0 | ||
|
||
Please refer to the notes in each sample for detailed compatibility information. | ||
|
||
|
@@ -88,9 +88,9 @@ When running the samples, parameters can be provided either on the command line, | |
|
||
Use a command like the following to display usage information for a particular sample. | ||
```` bash | ||
$java -ea -cp target/vsphere-samples-7.0.0.jar vmware.samples.vcenter.vm.list.ListVMs | ||
$java -ea -cp target/vsphere-samples-7.0.0.1.jar vmware.samples.vcenter.vm.list.ListVMs | ||
|
||
java -cp target/vsphere-samples-7.0.0.jar vmware.samples.vcenter.vm.list.ListVMs [--config-file <CONFIGURATION FILE>] | ||
java -cp target/vsphere-samples-7.0.0.1.jar vmware.samples.vcenter.vm.list.ListVMs [--config-file <CONFIGURATION FILE>] | ||
--server <SERVER> --username <USERNAME> --password <PASSWORD> --cluster <CLUSTER> [--truststorepath <ABSOLUTE PATH OF JAVA TRUSTSTORE FILE>] | ||
[--truststorepassword <JAVA TRUSTSTORE PASSWORD>] [--cleardata] [--skip-server-verification] | ||
|
||
|
@@ -114,17 +114,17 @@ Sample Options: | |
|
||
Use a command like the following to run a sample using only command line parameters: | ||
```` bash | ||
$java -ea -cp target/vsphere-samples-7.0.0.jar vmware.samples.vcenter.vm.list.ListVMs --server servername --username [email protected] --password password --skip-server-verification | ||
$java -ea -cp target/vsphere-samples-7.0.0.1.jar vmware.samples.vcenter.vm.list.ListVMs --server servername --username [email protected] --password password --skip-server-verification | ||
```` | ||
|
||
Use a command like the following to run a sample using only a configuration file: | ||
```` bash | ||
$java -ea -cp target/vsphere-samples-7.0.0.jar vmware.samples.vcenter.vm.list.ListVMs --config-file sample.properties | ||
$java -ea -cp target/vsphere-samples-7.0.0.1.jar vmware.samples.vcenter.vm.list.ListVMs --config-file sample.properties | ||
```` | ||
|
||
Use the following command to run the sample using a combination of configuration file and command line parameters: | ||
```` bash | ||
$java -ea -cp target/vsphere-samples-7.0.0.jar vmware.samples.vcenter.vm.list.ListVMs --config-file sample.properties --server servername | ||
$java -ea -cp target/vsphere-samples-7.0.0.1.jar vmware.samples.vcenter.vm.list.ListVMs --config-file sample.properties --server servername | ||
```` | ||
|
||
### Importing the samples to eclipse | ||
|
@@ -150,12 +150,12 @@ This will import a basic sample class to your package, which you can then custom | |
## API Documentation | ||
|
||
### vSphere API Documentation | ||
* [VMware vSphere APIs 7.0.0.1 (latest version)](https://vmware.github.io/vsphere-automation-sdk-java/vsphere/7.0.0.1/vsphereautomation-client-sdk/index.html). | ||
|
||
* [VMware Cloud on AWS vSphere (latest version)](https://vmware.github.io/vsphere-automation-sdk-java/vsphere/cloud/vsphereautomation-client-sdk/index.html). | ||
|
||
* [VMware vSphere APIs 6.7.3 (latest version)](https://vmware.github.io/vsphere-automation-sdk-java/vsphere/6.7.3/vsphereautomation-client-sdk/index.html). | ||
|
||
* Previous releases: [6.5](https://vmware.github.io/vsphere-automation-sdk-java/vsphere/6.5.0/vsphereautomation-client-sdk/index.html), [6.7.1](https://vmware.github.io/vsphere-automation-sdk-java/vsphere/6.7.1/vsphereautomation-client-sdk/index.html) | ||
* Previous releases: [6.7.3](https://vmware.github.io/vsphere-automation-sdk-java/vsphere/6.7.3/vsphereautomation-client-sdk/index.html), | ||
[6.7.1](https://vmware.github.io/vsphere-automation-sdk-java/vsphere/6.7.1/vsphereautomation-client-sdk/index.html) | ||
|
||
### VMware Cloud on AWS API Documentation | ||
|
||
|
@@ -229,8 +229,8 @@ Sample Exchange can be allowed to access your GitHub resources, by way of a link | |
Board members are volunteers from the SDK community and VMware staff members, board members are not held responsible for any issues which may occur from running of samples from this repository. | ||
Members: | ||
* Kunal Singh (VMware) | ||
* Jobin Jeorge (VMware) | ||
* Sumit Agrawal (VMware) | ||
* Shyla Srinivas (VMware) | ||
### Approval of Additions | ||
Items added to the repository, including items from the Board members, require 2 votes from the board members before being added to the repository. The approving members will have ideally downloaded and tested the item. When two “Approved for Merge” comments are added from board members, the pull can then be committed to the repository. | ||
|
@@ -240,5 +240,6 @@ Items added to the repository, including items from the Board members, require 2 | |
* [vSphere Automation SDK Overview](http://pubs.vmware.com/vsphere-65/index.jsp#com.vmware.vapi.progguide.doc/GUID-AF73991C-FC1C-47DF-8362-184B6544CFDE.html) | ||
* [VMware Code](https://code.vmware.com/home) | ||
* [VMware Developer Community](https://communities.vmware.com/community/vmtn/developer) | ||
* VMware vSphere [Java API Reference documentation](https://vmware.github.io/vsphere-automation-sdk-java/vsphere/6.7.3/vsphereautomation-client-sdk/index.html). | ||
* VMware vSphere [Java API Reference documentation](https://vmware.github.io/vsphere-automation-sdk-java/vsphere/7.0.0.1/vsphereautomation-client-sdk/index.html). | ||
* [VMware Java forum](https://code.vmware.com/forums/7508/vsphere-automation-sdk-for-java) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+28.4 KB
lib/vapi-authentication-2.14.0.jar → lib/vapi-authentication-2.15.0.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+17.2 MB
...reautomation-client-sdk-3.2.0-javadoc.jar → ...reautomation-client-sdk-3.3.0-javadoc.jar
Binary file not shown.
Binary file renamed
BIN
+7.67 MB
lib/vsphereautomation-client-sdk-3.2.0.jar → lib/vsphereautomation-client-sdk-3.3.0.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/vmware/samples/common/AuthorizationConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package vmware.samples.common; | ||
|
||
public class AuthorizationConstants { | ||
public static final String CLIENT_ID="clientId"; | ||
public static final String CLIENT_SECRET="clientSecret"; | ||
public static final String REDIRECT_URI="redirect_uri"; | ||
public static final String REDIRECT_URIS="redirectUris"; | ||
} |
63 changes: 63 additions & 0 deletions
63
src/main/java/vmware/samples/common/AuthorizationUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* ******************************************************* | ||
* Copyright VMware, Inc. 2019. All Rights Reserved. | ||
* SPDX-License-Identifier: MIT | ||
* ******************************************************* | ||
* | ||
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, WHETHER ORAL OR WRITTEN, | ||
* EXPRESS OR IMPLIED. THE AUTHOR SPECIFICALLY DISCLAIMS ANY IMPLIED | ||
* WARRANTIES OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, | ||
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. | ||
*/ | ||
package vmware.samples.common; | ||
|
||
import java.util.Map; | ||
|
||
import com.vmware.authorization.AuthorizationRequestExecutor; | ||
import com.vmware.authorization.Constants; | ||
import com.vmware.authorization.IDPFactory; | ||
import com.vmware.authorization.IdentityProviderType; | ||
import com.vmware.authorization.grant.AuthorizationGrant; | ||
import com.vmware.vapi.bindings.Service; | ||
import com.vmware.vapi.bindings.StubConfiguration; | ||
import com.vmware.vapi.protocol.HttpConfiguration; | ||
import com.vmware.vapi.saml.SamlToken; | ||
|
||
import vmware.samples.common.authentication.VapiAuthenticationHelper; | ||
import vmware.samples.vcenter.identity.helpers.VcenterIdentityProvider; | ||
import vmware.samples.vcenter.identity.helpers.VcenterTokenExchange; | ||
|
||
public class AuthorizationUtil { | ||
|
||
private AuthorizationUtil() {} | ||
|
||
public static IdentityProviderType getDefaultIdentityProviderWithType(String vcenterServer, | ||
boolean skipServerVerification) throws Exception { | ||
VcenterIdentityProvider vip = new VcenterIdentityProvider(); | ||
IdentityProviderType identityType = vip.getDefaultIdentityProviderWithType(vcenterServer, | ||
skipServerVerification); | ||
return identityType; | ||
|
||
} | ||
public static <T extends Service> T getStub(Class<T> serviceClass, IdentityProviderType identityType, | ||
AuthorizationGrant grantType, String vcenterServer) throws Exception { | ||
|
||
AuthorizationRequestExecutor grantExecutor = IDPFactory.getAuthRequestExecutor(identityType.getType(), | ||
grantType); | ||
Map<String, String> map = grantExecutor.getAccessAndIdToken(); | ||
VcenterTokenExchange tokenSer = new VcenterTokenExchange(); | ||
SamlToken samlToken = tokenSer.getSAMLToken(map.get(Constants.ACCESS_TOKEN), | ||
map.get(Constants.ID_TOKEN), vcenterServer); | ||
//System.out.println("SAML Bearer Token :" + samlToken); | ||
VapiAuthenticationHelper vapiHelper = new VapiAuthenticationHelper(); | ||
HttpConfiguration httpConfig = vapiHelper.buildHttpConfiguration(true); | ||
StubConfiguration sessionStubConfig = vapiHelper | ||
.loginBySamlBearerToken(vcenterServer, samlToken, httpConfig); | ||
|
||
return vapiHelper.getStubFactory().createStub(serviceClass, | ||
sessionStubConfig); | ||
|
||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.