mirror of
https://github.com/vmware/vsphere-automation-sdk-python.git
synced 2024-11-24 18:30:00 -05:00
2d2f32b923
* differentiating required and optional arguments in the help text for vmc samples Signed-off-by: Anusha Hegde <hegdeanusha25@gmail.com>
60 lines
1.9 KiB
Python
60 lines
1.9 KiB
Python
"""
|
|
* *******************************************************
|
|
* Copyright (c) VMware, Inc. 2016. 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.'
|
|
__copyright__ = 'Copyright 2016 VMware, Inc. All rights reserved.'
|
|
|
|
import argparse
|
|
|
|
|
|
def build_arg_parser():
|
|
"""
|
|
Builds a standard argument parser with arguments for talking to vCenter
|
|
|
|
-s server
|
|
-u username
|
|
-p password
|
|
-c cleanup
|
|
-v skipverification
|
|
|
|
"""
|
|
parser = argparse.ArgumentParser(
|
|
description='Standard Arguments for talking to vCenter')
|
|
|
|
required_args = parser.add_argument_group(
|
|
'required arguments')
|
|
required_args.add_argument('-s', '--server',
|
|
action='store',
|
|
required=True,
|
|
help='vSphere service IP to connect to')
|
|
|
|
required_args.add_argument('-u', '--username',
|
|
action='store',
|
|
required=True,
|
|
help='Username to use when connecting to vc')
|
|
|
|
required_args.add_argument('-p', '--password',
|
|
action='store',
|
|
required=True,
|
|
help='Password to use when connecting to vc')
|
|
|
|
parser.add_argument('-c', '--cleardata',
|
|
action='store_true',
|
|
help='Clean up after sample run. ')
|
|
|
|
parser.add_argument('-v', '--skipverification',
|
|
action='store_true',
|
|
help='Verify server certificate when connecting to vc.')
|
|
|
|
return parser
|