本文整理汇总了Python中vcd_cli.utils.stdout函数的典型用法代码示例。如果您正苦于以下问题:Python stdout函数的具体用法?Python stdout怎么用?Python stdout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stdout函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: delete_firewall_rule_service
def delete_firewall_rule_service(ctx, name, id, protocol):
try:
firewall_rule_resource = get_firewall_rule(ctx, name, id)
firewall_rule_resource.delete_firewall_rule_service(protocol)
stdout('Firewall rule\'s service deleted successfully', ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:7,代码来源:firewall_rule.py
示例2: list_ipsec_vpn
def list_ipsec_vpn(ctx, gateway_name):
try:
gateway_resource = get_gateway(ctx, gateway_name)
result = gateway_resource.list_ipsec_vpn()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:7,代码来源:ipsec_vpn.py
示例3: info_ipsec_vpn
def info_ipsec_vpn(ctx, gateway_name, id):
try:
ipsec_vpn_obj = get_ipsec_vpn(ctx, gateway_name, id)
result = ipsec_vpn_obj.get_vpn_site_info()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:7,代码来源:ipsec_vpn.py
示例4: info_activation_status
def info_activation_status(ctx, gateway_name):
try:
gateway_resource = get_gateway(ctx, gateway_name)
result = gateway_resource.info_activation_status_ipsec_vpn()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:7,代码来源:ipsec_vpn.py
示例5: info_logging_settings
def info_logging_settings(ctx, gateway_name):
try:
gateway_resource = get_gateway(ctx, gateway_name)
result = gateway_resource.info_logging_settings_ipsec_vpn()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:7,代码来源:ipsec_vpn.py
示例6: list_service_certificate
def list_service_certificate(ctx, gateway_name):
try:
gateway_resource = get_gateway(ctx, gateway_name)
result = gateway_resource.list_service_certificates()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:7,代码来源:service_certificates.py
示例7: delete_ipsec_vpn
def delete_ipsec_vpn(ctx, gateway_name, id):
try:
ipsec_vpn_obj = get_ipsec_vpn(ctx, gateway_name, id)
ipsec_vpn_obj.delete_ipsec_vpn()
stdout('IPsec VPN deleted successfully.', ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:7,代码来源:ipsec_vpn.py
示例8: delete_dhcp_pool
def delete_dhcp_pool(ctx, gateway_name, pool_id):
try:
resource = get_dhcp_pool(ctx, gateway_name, pool_id)
resource.delete_pool()
stdout('DHCP Pool deleted successfully.', ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:7,代码来源:dhcp_pool.py
示例9: list_dhcp_pool
def list_dhcp_pool(ctx, gateway_name):
try:
gateway_resource = get_gateway(ctx, gateway_name)
result = gateway_resource.list_dhcp_pools()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:7,代码来源:dhcp_pool.py
示例10: create
def create(ctx, name, pvdc_name, network_pool_name, allocation_model, sp_name,
sp_limit, description, cpu_allocated, cpu_limit):
try:
restore_session(ctx)
client = ctx.obj['client']
in_use_org_href = ctx.obj['profiles'].get('org_href')
org = Org(client, in_use_org_href)
storage_profiles = [{
'name': sp_name,
'enabled': True,
'units': 'MB',
'limit': sp_limit,
'default': True
}]
vdc_resource = org.create_org_vdc(
name,
pvdc_name,
network_pool_name=network_pool_name,
description=description,
allocation_model=allocation_model,
cpu_allocated=cpu_allocated,
cpu_limit=cpu_limit,
storage_profiles=storage_profiles,
uses_fast_provisioning=True,
is_thin_provision=True)
stdout(vdc_resource.Tasks.Task[0], ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:28,代码来源:vdc.py
示例11: create_isolated_network
def create_isolated_network(ctx, name, gateway_ip, netmask, description,
primary_dns_ip, secondary_dns_ip, dns_suffix,
ip_range_start, ip_range_end, is_dhcp_enabled,
default_lease_time, max_lease_time,
dhcp_ip_range_start, dhcp_ip_range_end, is_shared):
try:
restore_session(ctx, vdc_required=True)
client = ctx.obj['client']
in_use_vdc_href = ctx.obj['profiles'].get('vdc_href')
vdc = VDC(client, href=in_use_vdc_href)
prefix_len = netmask_to_cidr_prefix_len(gateway_ip, netmask)
network_cidr = gateway_ip + '/' + str(prefix_len)
result = vdc.create_isolated_vdc_network(
network_name=name,
network_cidr=network_cidr,
description=description,
primary_dns_ip=primary_dns_ip,
secondary_dns_ip=secondary_dns_ip,
dns_suffix=dns_suffix,
ip_range_start=ip_range_start,
ip_range_end=ip_range_end,
is_dhcp_enabled=is_dhcp_enabled,
default_lease_time=default_lease_time,
max_lease_time=max_lease_time,
dhcp_ip_range_start=dhcp_ip_range_start,
dhcp_ip_range_end=dhcp_ip_range_end,
is_shared=is_shared)
stdout(result.Tasks.Task[0], ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:32,代码来源:network.py
示例12: use
def use(ctx, name):
try:
restore_session(ctx)
client = ctx.obj['client']
in_use_org_name = ctx.obj['profiles'].get('org_in_use')
orgs = client.get_org_list()
for org_resource in orgs:
if org_resource.get('name').lower() == in_use_org_name.lower():
for link in get_links(org_resource,
media_type=EntityType.VDC.value):
if link.name == name:
vdc_in_use = name
vapp_in_use = ''
vapp_href = ''
client.get_resource(link.href)
ctx.obj['profiles'].set('vdc_in_use', vdc_in_use)
ctx.obj['profiles'].set('vdc_href', str(link.href))
ctx.obj['profiles'].set('vapp_in_use', vapp_in_use)
ctx.obj['profiles'].set('vapp_href', vapp_href)
message = 'now using org: \'%s\', vdc: \'%s\', vApp:' \
' \'%s\'.' % (in_use_org_name, vdc_in_use,
vapp_in_use)
stdout({
'org': in_use_org_name,
'vdc': vdc_in_use,
'vapp': vapp_in_use
}, ctx, message)
return
raise Exception('Org \'%s\' not found' % in_use_org_name)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:31,代码来源:vdc.py
示例13: capture
def capture(ctx, name, catalog, template, customizable, description):
try:
restore_session(ctx, vdc_required=True)
client = ctx.obj['client']
in_use_org_href = ctx.obj['profiles'].get('org_href')
org = Org(client, in_use_org_href)
catalog_resource = org.get_catalog(catalog)
vdc_href = ctx.obj['profiles'].get('vdc_href')
vdc = VDC(client, href=vdc_href)
vapp_resource = vdc.get_vapp(name)
overwrite = False
if template is None:
template = vapp_resource.get('name')
else:
overwrite = True
task = org.capture_vapp(
catalog_resource,
vapp_href=vapp_resource.get('href'),
catalog_item_name=template,
description=description,
customize_on_instantiate=customizable == 'customizable',
overwrite=overwrite)
stdout(task, ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:25,代码来源:vapp.py
示例14: create
def create(ctx, name, description, catalog, template, network, memory, cpu,
disk_size, ip_allocation_mode, vm_name, hostname, storage_profile,
accept_all_eulas):
try:
restore_session(ctx, vdc_required=True)
client = ctx.obj['client']
vdc_href = ctx.obj['profiles'].get('vdc_href')
vdc = VDC(client, href=vdc_href)
if catalog is None and template is None:
vapp_resource = vdc.create_vapp(
name,
description=description,
network=network,
accept_all_eulas=accept_all_eulas)
else:
vapp_resource = vdc.instantiate_vapp(
name,
catalog,
template,
description=description,
network=network,
memory=memory,
cpu=cpu,
disk_size=disk_size,
deploy=True,
power_on=True,
accept_all_eulas=accept_all_eulas,
cust_script=None,
ip_allocation_mode=ip_allocation_mode,
vm_name=vm_name,
hostname=hostname,
storage_profile=storage_profile)
stdout(vapp_resource.Tasks.Task[0], ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:35,代码来源:vapp.py
示例15: create
def create(ctx, user_name, password, role_name, full_name, description, email,
telephone, im, enabled, alert_enabled, alert_email,
alert_email_prefix, external, default_cached, group_role,
stored_vm_quota, deployed_vm_quota):
try:
if len(password) < 6:
raise Exception('Password must be at least 6 characters long.')
restore_session(ctx)
client = ctx.obj['client']
in_use_org_href = ctx.obj['profiles'].get('org_href')
org = Org(client, in_use_org_href)
role = org.get_role_record(role_name)
role_href = role.get('href')
result = org.create_user(
user_name=user_name,
password=password,
role_href=role_href,
full_name=full_name,
description=description,
email=email,
telephone=telephone,
im=im,
alert_email=alert_email,
alert_email_prefix=alert_email_prefix,
stored_vm_quota=stored_vm_quota,
deployed_vm_quota=deployed_vm_quota,
is_group_role=group_role,
is_default_cached=default_cached,
is_external=external,
is_alert_enabled=alert_enabled,
is_enabled=enabled)
stdout('User \'%s\' is successfully created.' % result.get('name'),
ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:35,代码来源:user.py
示例16: info_dhcp_pool
def info_dhcp_pool(ctx, gateway_name, pool_id):
try:
resource = get_dhcp_pool(ctx, gateway_name, pool_id)
result = resource.get_pool_info()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:7,代码来源:dhcp_pool.py
示例17: delete_service_certificate
def delete_service_certificate(ctx, gateway_name, id):
try:
certificate_obj = get_service_certificate(ctx, gateway_name, id)
certificate_obj.delete_certificate()
stdout('Service certificate deleted successfully.', ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:7,代码来源:service_certificates.py
示例18: list_catalogs_or_items
def list_catalogs_or_items(ctx, catalog_name):
try:
restore_session(ctx)
client = ctx.obj['client']
if catalog_name is None:
in_use_org_href = ctx.obj['profiles'].get('org_href')
org = Org(client, in_use_org_href)
result = org.list_catalogs()
else:
result = []
if is_sysadmin(ctx):
resource_type = ResourceType.ADMIN_CATALOG_ITEM.value
else:
resource_type = ResourceType.CATALOG_ITEM.value
q = client.get_typed_query(
resource_type,
query_result_format=QueryResultFormat.ID_RECORDS,
equality_filter=('catalogName', catalog_name))
records = list(q.execute())
if len(records) == 0:
result = 'not found'
else:
for r in records:
result.append(to_dict(r, resource_type=resource_type))
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:27,代码来源:catalog.py
示例19: use
def use(ctx, name):
try:
restore_session(ctx)
client = ctx.obj['client']
org_resource = client.get_org_by_name(name)
in_use_vdc = ''
vdc_href = ''
in_use_vapp = ''
vapp_href = ''
for link in get_links(org_resource, media_type=EntityType.VDC.value):
in_use_vdc = link.name
vdc_href = link.href
break
ctx.obj['profiles'].set('org_in_use', str(name))
ctx.obj['profiles'].set('org_href', str(org_resource.get('href')))
ctx.obj['profiles'].set('vdc_in_use', str(in_use_vdc))
ctx.obj['profiles'].set('vdc_href', str(vdc_href))
ctx.obj['profiles'].set('vapp_in_use', str(in_use_vapp))
ctx.obj['profiles'].set('vapp_href', vapp_href)
message = 'now using org: \'%s\', vdc: \'%s\', vApp: \'%s\'.' \
% (name, in_use_vdc, in_use_vapp)
stdout({
'org': name,
'vdc': in_use_vdc,
'vapp': in_use_vapp
}, ctx, message)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:28,代码来源:org.py
示例20: info
def info(ctx, catalog_name, item_name):
try:
restore_session(ctx)
client = ctx.obj['client']
in_use_org_href = ctx.obj['profiles'].get('org_href')
org = Org(client, in_use_org_href)
if item_name is None:
catalog = org.get_catalog(catalog_name)
result = to_dict(catalog)
# We don't have a way to know in advance if a user has access to a
# catalog's ACL or not. So we try to retrieve it always. If the
# call fails due to permission issues, we silently eat the
# exception and exclude ACL settings from the output of the current
# command. Users who have access to ACL of the catalog will remain
# unaffected. Also any other errors/exceptions will bubble up as
# usual.
try:
access_control_settings = access_settings_to_dict(
org.get_catalog_access_settings(catalog_name))
result.update(access_control_settings)
except AccessForbiddenException as e:
pass
else:
catalog_item = org.get_catalog_item(catalog_name, item_name)
result = to_dict(catalog_item)
vapp = VApp(client, href=catalog_item.Entity.get('href'))
vapp.reload()
template = vapp_to_dict(vapp.resource)
for k, v in template.items():
result['template-%s' % k] = v
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:33,代码来源:catalog.py
注:本文中的vcd_cli.utils.stdout函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论