mirror of
https://github.com/vmware/vsphere-automation-sdk-python.git
synced 2024-11-23 01:49:59 -05:00
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
|
#!/usr/bin/env python
|
||
|
"""
|
||
|
* *******************************************************
|
||
|
* 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
|
||
|
|
||
|
|
||
|
"""
|
||
|
Description: Demonstrates services api workflow
|
||
|
1.List all services
|
||
|
|
||
|
"""
|
||
|
|
||
|
parser = sample_cli.build_arg_parser()
|
||
|
args = sample_util.process_cli_args(parser.parse_args())
|
||
|
session = get_unverified_session() if args.skipverification else None
|
||
|
client = create_vsphere_client(server=args.server,
|
||
|
username=args.username,
|
||
|
password=args.password,
|
||
|
session=session)
|
||
|
|
||
|
service_list = client.appliance.Services.list()
|
||
|
|
||
|
print("Example: List Appliance Services:")
|
||
|
print("-------------------\n")
|
||
|
for key, values in service_list.items():
|
||
|
print("Service Name : {} ".format(key))
|
||
|
print("value : {}".format(values.description))
|
||
|
print("State: {} \n".format(values.state))
|