Skip to content

Commit 0f9cd16

Browse files
author
Kunal Singh
authored
Merge pull request #204 from kunal-pmj/master
Libraries and Samples for VMC M9 release
2 parents f87594f + 8ec4076 commit 0f9cd16

36 files changed

+1389
-25
lines changed

lib/vapi-client-bindings/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<a href='vapi_client_bindings-3.1.0-py2.py3-none-any.whl'>vapi_client_bindings-3.1.0-py2.py3-none-any.whl</a><br />
1+
<a href='vapi_client_bindings-3.2.0-py2.py3-none-any.whl'>vapi_client_bindings-3.2.0-py2.py3-none-any.whl</a><br />
Binary file not shown.
Binary file not shown.

lib/vapi-common-client/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<a href='vapi_common_client-2.12.0-py2.py3-none-any.whl'>vapi_common_client-2.12.0-py2.py3-none-any.whl</a><br />
1+
<a href='vapi_common_client-2.14.0-py2.py3-none-any.whl'>vapi_common_client-2.14.0-py2.py3-none-any.whl</a><br />
Binary file not shown.
Binary file not shown.

lib/vapi-runtime/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<a href='vapi_runtime-2.12.0-py2.py3-none-any.whl'>vapi_runtime-2.12.0-py2.py3-none-any.whl</a><br />
1+
<a href='vapi_runtime-2.14.0-py2.py3-none-any.whl'>vapi_runtime-2.14.0-py2.py3-none-any.whl</a><br />

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ lxml >= 4.3.0
22
pyVmomi >= 6.7
33
suds ; python_version < '3'
44
suds-jurko ; python_version >= '3.0'
5-
vapi-client-bindings == 3.1.0
5+
vapi-client-bindings == 3.2.0
66
vmc-client-bindings
77
nsx-python-sdk
88
nsx-policy-python-sdk

samples/vmc/helpers/sample_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
'optional arguments')
3636

3737
required_args.add_argument(
38-
'--refresh_token',
38+
'--refresh-token',
3939
required=True,
4040
help='Refresh token obtained from CSP')
4141
required_args.add_argument(
42-
'--org_id',
42+
'--org-id',
4343
required=True,
4444
help='Orgization ID')
4545
required_args.add_argument(
46-
'--sddc_id',
46+
'--sddc-id',
4747
required=True,
4848
help='SDDC ID')

samples/vmc/networks_nsxt/l3_vpn_crud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class NSXPolicyL3VPN(object):
3939
"""
4040

4141
def __init__(self):
42-
required_args.add_argument('--remote_endpoint_public_ip',
42+
required_args.add_argument('--remote-endpoint-public-ip',
4343
required=True,
4444
help='L3 VPN Remote end point\'s public ip')
4545

samples/vmc/networks_nsxt/security_group_create.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@
3636
Sample Prerequisites:
3737
- SDDC deployed in VMware Cloud on AWS
3838
"""
39-
optional_args.add_argument('--gateway_type',
39+
optional_args.add_argument('--gateway-type',
4040
default='mgw',
4141
help='Gateway type. Either mgw or cgw')
4242

4343
required_args.add_argument('--name',
4444
required=True,
4545
help='Name of the security group to be created')
4646

47-
optional_args.add_argument('--ip_address',
47+
optional_args.add_argument('--ip-address',
4848
default='172.31.0.0/24',
4949
help='IP address for the expression')
5050

51-
optional_args.add_argument('--group_id',
51+
optional_args.add_argument('--group-id',
5252
help='ID of the group. A random ID will be used by default')
5353

5454
args = parser.parse_args()

samples/vmc/networks_nsxt/security_group_delete.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
- SDDC deployed in VMware Cloud on AWS
4040
- A NSX-T security group
4141
"""
42-
optional_args.add_argument('--gateway_type',
42+
optional_args.add_argument('--gateway-type',
4343
default='mgw',
4444
help='Gateway type. Either mgw or cgw')
4545

46-
optional_args.add_argument('--group_id',
46+
optional_args.add_argument('--group-id',
4747
help='ID of the group to be deleted')
4848

4949
args = parser.parse_args()

samples/vmc/networks_nsxt/security_group_update.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
- SDDC deployed in VMware Cloud on AWS
4141
- A NSX-T security group
4242
"""
43-
optional_args.add_argument('--gateway_type',
43+
optional_args.add_argument('--gateway-type',
4444
default='mgw',
4545
help='Gateway type. Either mgw or cgw')
4646

47-
optional_args.add_argument('--group_id',
47+
optional_args.add_argument('--group-id',
4848
help='ID of the group to be updated')
4949

5050
required_args.add_argument('--name',

samples/vmc/orgs/organization_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def options(self):
4141
required_args = parser.add_argument_group(
4242
'required arguments')
4343
required_args.add_argument(
44-
'--refresh_token',
44+
'--refresh-token',
4545
required=True,
4646
help='VMware Cloud API refresh token')
4747

samples/vmc/tasks/cancel_task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
'required arguments')
3333

3434
required_args.add_argument(
35-
'--refresh_token',
35+
'--refresh-token',
3636
required=True,
3737
help='Refresh token obtained from CSP')
3838

samples/vmc/tasks/list_tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
'required arguments')
3535

3636
required_args.add_argument(
37-
'--refresh_token',
37+
'--refresh-token',
3838
required=True,
3939
help='Refresh token obtained from CSP')
4040
required_args.add_argument(

samples/vmc/tasks/list_tasks_stg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
'optional arguments')
3737

3838
required_args.add_argument(
39-
'--refresh_token',
39+
'--refresh-token',
4040
required=True,
4141
help='Refresh token obtained from CSP')
4242

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""
2+
* *******************************************************
3+
* Copyright (c) VMware, Inc. 2019. All Rights Reserved.
4+
* SPDX-License-Identifier: MIT
5+
* *******************************************************
6+
*
7+
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
8+
* WARRANTIES OR CONDITIONS OF ANY KIND, WHETHER ORAL OR WRITTEN,
9+
* EXPRESS OR IMPLIED. THE AUTHOR SPECIFICALLY DISCLAIMS ANY IMPLIED
10+
* WARRANTIES OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY,
11+
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
12+
"""
13+
14+
__author__ = 'VMware, Inc.'
15+
__vcenter_version__ = '6.7+'
16+
17+
from vmware.vapi.vsphere.client import create_vsphere_client
18+
19+
from samples.vsphere.common import (sample_cli, sample_util)
20+
from samples.vsphere.common.ssl_helper import get_unverified_session
21+
22+
23+
"""
24+
Demonstrates setting and getting TimeZone.Accepted values are
25+
26+
valid Timezone values for appliance
27+
28+
"""
29+
30+
parser = sample_cli.build_arg_parser()
31+
32+
parser.add_argument(
33+
'--time_sync',
34+
required=True,
35+
action='store',
36+
choices=['DISABLED', 'HOST'],
37+
help='DISABLED,time synchronization is disabled and HOST,Host time synchronization ')
38+
39+
args = sample_util.process_cli_args(parser.parse_args())
40+
time_sync = args.time_sync
41+
42+
# Connect to vAPI services
43+
session = get_unverified_session() if args.skipverification else None
44+
client = create_vsphere_client(server=args.server,
45+
username=args.username,
46+
password=args.password,
47+
session=session)
48+
timesync_mode = client.appliance.Timesync.TimeSyncMode(time_sync)
49+
print("Setting the appliance time syncronization as : " + time_sync)
50+
client.appliance.Timesync.set(timesync_mode)
51+
print("Timesync as : " + client.appliance.Timesync.get())

samples/vsphere/contentlibrary/lib/cls_api_client.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
LocalLibrary,
1919
SubscribedLibrary)
2020
from com.vmware.content.library_client import Item, SubscribedItem, Subscriptions
21+
from com.vmware.content.library.item_client import Changes
2122
from com.vmware.content.library.item_client import DownloadSession
2223
from com.vmware.content.library.item_client import UpdateSession
2324
from com.vmware.content.library.item.downloadsession_client import File as DownloadSessionFile
@@ -26,6 +27,7 @@
2627
from com.vmware.vcenter.iso_client import Image
2728
from com.vmware.vcenter.ovf_client import LibraryItem
2829
from com.vmware.vcenter.vm_template_client import LibraryItems as VmtxLibraryItem
30+
from com.vmware.vcenter.vm_template.library_items_client import CheckOuts, Versions
2931

3032

3133
class ClsApiClient(object):
@@ -77,9 +79,23 @@ def __init__(self, service_manager):
7779
# machine templates
7880
self.vmtx_service = VmtxLibraryItem(self.service_manager.stub_config)
7981

80-
# ####
82+
# Returns the service for managing subscription information of
83+
# the subscribers of a published library.
8184
self.subscriptions = Subscriptions(self.service_manager.stub_config)
8285

8386
# Creates the service that communicates with virtual machines
8487
self.vm_service = VM(self.service_manager.stub_config)
88+
89+
# Returns the service for managing checkouts of a library item containing
90+
# a virtual machine template
91+
self.check_outs_service = CheckOuts(self.service_manager.stub_config)
92+
93+
# Returns the service for managing the live versions of the virtual machine
94+
# templates contained in a library item
95+
self.versions_service = Versions(self.service_manager.stub_config)
96+
97+
# Returns the service for managing the history of content changes made
98+
# to a library item
99+
self.changes_service = Changes(self.service_manager.stub_config)
100+
85101
# TODO: Add the other CLS services, eg. storage, config, type

0 commit comments

Comments
 (0)