com.vmware.vim25.mo.samples.network.AddVirtualNic.class Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vijava Show documentation
Show all versions of vijava Show documentation
Java API for accessing VMWare web services API
The newest version!
???? 2 ? 1com/vmware/vim25/mo/samples/network/AddVirtualNic java/lang/Object ()V Code
LineNumberTable LocalVariableTable this 3Lcom/vmware/vim25/mo/samples/network/AddVirtualNic; main ([Ljava/lang/String;)V
Exceptions java/lang/Exception *com/vmware/vim25/mo/util/CommandLineParser
constructOptions (()[Lcom/vmware/vim25/mo/util/OptionSpec;
<([Lcom/vmware/vim25/mo/util/OptionSpec;[Ljava/lang/String;)V url
!
get_option &(Ljava/lang/String;)Ljava/lang/String; # username % password '
datacenter ) host +
portgroupname - ipaddress / #com/vmware/vim25/mo/ServiceInstance 1 java/net/URL
0 3 4 (Ljava/lang/String;)V
. 6 7 6(Ljava/net/URL;Ljava/lang/String;Ljava/lang/String;Z)V
. 9 : ;
getRootFolder ()Lcom/vmware/vim25/mo/Folder; = ? > java/lang/System @ A out Ljava/io/PrintStream; C Hostname cannot be empty!
E G F java/io/PrintStream H 4 println J &com/vmware/vim25/mo/InventoryNavigator
I L M &(Lcom/vmware/vim25/mo/ManagedEntity;)V O
Datacenter
I Q R S searchManagedEntity I(Ljava/lang/String;Ljava/lang/String;)Lcom/vmware/vim25/mo/ManagedEntity; U com/vmware/vim25/mo/Datacenter W
HostSystem Y com/vmware/vim25/mo/HostSystem [ Host not found
X ] ^ _ getHostNetworkSystem )()Lcom/vmware/vim25/mo/HostNetworkSystem; a "com/vmware/vim25/HostPortGroupSpec
`
` d e 4 setName
g h i createVNicSpecification 9(Ljava/lang/String;)Lcom/vmware/vim25/HostVirtualNicSpec;
k m l %com/vmware/vim25/mo/HostNetworkSystem n o
addVirtualNic K(Ljava/lang/String;Lcom/vmware/vim25/HostVirtualNicSpec;)Ljava/lang/String; q GFailed : IP address or subnet mask in the IP configuration are invalid s