Skip to content

Libraries and Samples for VMC M9 release #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/vapi-client-bindings/index.html
Original file line number Diff line number Diff line change
@@ -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 />
<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.
2 changes: 1 addition & 1 deletion lib/vapi-common-client/index.html
Original file line number Diff line number Diff line change
@@ -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 />
<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.
2 changes: 1 addition & 1 deletion lib/vapi-runtime/index.html
Original file line number Diff line number Diff line change
@@ -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 />
<a href='vapi_runtime-2.14.0-py2.py3-none-any.whl'>vapi_runtime-2.14.0-py2.py3-none-any.whl</a><br />
Binary file not shown.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lxml >= 4.3.0
pyVmomi >= 6.7
suds ; python_version < '3'
suds-jurko ; python_version >= '3.0'
vapi-client-bindings == 3.1.0
vapi-client-bindings == 3.2.0
vmc-client-bindings
nsx-python-sdk
nsx-policy-python-sdk
Expand Down
6 changes: 3 additions & 3 deletions samples/vmc/helpers/sample_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
'optional arguments')

required_args.add_argument(
'--refresh_token',
'--refresh-token',
required=True,
help='Refresh token obtained from CSP')
required_args.add_argument(
'--org_id',
'--org-id',
required=True,
help='Orgization ID')
required_args.add_argument(
'--sddc_id',
'--sddc-id',
required=True,
help='SDDC ID')
2 changes: 1 addition & 1 deletion samples/vmc/networks_nsxt/l3_vpn_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class NSXPolicyL3VPN(object):
"""

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

Expand Down
6 changes: 3 additions & 3 deletions samples/vmc/networks_nsxt/security_group_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@
Sample Prerequisites:
- SDDC deployed in VMware Cloud on AWS
"""
optional_args.add_argument('--gateway_type',
optional_args.add_argument('--gateway-type',
default='mgw',
help='Gateway type. Either mgw or cgw')

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

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

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

args = parser.parse_args()
Expand Down
4 changes: 2 additions & 2 deletions samples/vmc/networks_nsxt/security_group_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
- SDDC deployed in VMware Cloud on AWS
- A NSX-T security group
"""
optional_args.add_argument('--gateway_type',
optional_args.add_argument('--gateway-type',
default='mgw',
help='Gateway type. Either mgw or cgw')

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

args = parser.parse_args()
Expand Down
4 changes: 2 additions & 2 deletions samples/vmc/networks_nsxt/security_group_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
- SDDC deployed in VMware Cloud on AWS
- A NSX-T security group
"""
optional_args.add_argument('--gateway_type',
optional_args.add_argument('--gateway-type',
default='mgw',
help='Gateway type. Either mgw or cgw')

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

required_args.add_argument('--name',
Expand Down
2 changes: 1 addition & 1 deletion samples/vmc/orgs/organization_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def options(self):
required_args = parser.add_argument_group(
'required arguments')
required_args.add_argument(
'--refresh_token',
'--refresh-token',
required=True,
help='VMware Cloud API refresh token')

Expand Down
2 changes: 1 addition & 1 deletion samples/vmc/tasks/cancel_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
'required arguments')

required_args.add_argument(
'--refresh_token',
'--refresh-token',
required=True,
help='Refresh token obtained from CSP')

Expand Down
2 changes: 1 addition & 1 deletion samples/vmc/tasks/list_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
'required arguments')

required_args.add_argument(
'--refresh_token',
'--refresh-token',
required=True,
help='Refresh token obtained from CSP')
required_args.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion samples/vmc/tasks/list_tasks_stg.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
'optional arguments')

required_args.add_argument(
'--refresh_token',
'--refresh-token',
required=True,
help='Refresh token obtained from CSP')

Expand Down
51 changes: 51 additions & 0 deletions samples/vsphere/appliances/timezone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"""
* *******************************************************
* Copyright (c) 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.
"""

__author__ = 'VMware, Inc.'
__vcenter_version__ = '6.7+'

from vmware.vapi.vsphere.client import create_vsphere_client

from samples.vsphere.common import (sample_cli, sample_util)
from samples.vsphere.common.ssl_helper import get_unverified_session


"""
Demonstrates setting and getting TimeZone.Accepted values are

valid Timezone values for appliance

"""

parser = sample_cli.build_arg_parser()

parser.add_argument(
'--time_sync',
required=True,
action='store',
choices=['DISABLED', 'HOST'],
help='DISABLED,time synchronization is disabled and HOST,Host time synchronization ')

args = sample_util.process_cli_args(parser.parse_args())
time_sync = args.time_sync

# Connect to vAPI services
session = get_unverified_session() if args.skipverification else None
client = create_vsphere_client(server=args.server,
username=args.username,
password=args.password,
session=session)
timesync_mode = client.appliance.Timesync.TimeSyncMode(time_sync)
print("Setting the appliance time syncronization as : " + time_sync)
client.appliance.Timesync.set(timesync_mode)
print("Timesync as : " + client.appliance.Timesync.get())
18 changes: 17 additions & 1 deletion samples/vsphere/contentlibrary/lib/cls_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
LocalLibrary,
SubscribedLibrary)
from com.vmware.content.library_client import Item, SubscribedItem, Subscriptions
from com.vmware.content.library.item_client import Changes
from com.vmware.content.library.item_client import DownloadSession
from com.vmware.content.library.item_client import UpdateSession
from com.vmware.content.library.item.downloadsession_client import File as DownloadSessionFile
Expand All @@ -26,6 +27,7 @@
from com.vmware.vcenter.iso_client import Image
from com.vmware.vcenter.ovf_client import LibraryItem
from com.vmware.vcenter.vm_template_client import LibraryItems as VmtxLibraryItem
from com.vmware.vcenter.vm_template.library_items_client import CheckOuts, Versions


class ClsApiClient(object):
Expand Down Expand Up @@ -77,9 +79,23 @@ def __init__(self, service_manager):
# machine templates
self.vmtx_service = VmtxLibraryItem(self.service_manager.stub_config)

# ####
# Returns the service for managing subscription information of
# the subscribers of a published library.
self.subscriptions = Subscriptions(self.service_manager.stub_config)

# Creates the service that communicates with virtual machines
self.vm_service = VM(self.service_manager.stub_config)

# Returns the service for managing checkouts of a library item containing
# a virtual machine template
self.check_outs_service = CheckOuts(self.service_manager.stub_config)

# Returns the service for managing the live versions of the virtual machine
# templates contained in a library item
self.versions_service = Versions(self.service_manager.stub_config)

# Returns the service for managing the history of content changes made
# to a library item
self.changes_service = Changes(self.service_manager.stub_config)

# TODO: Add the other CLS services, eg. storage, config, type
Loading