def do_share_server_show(cs, args): """Show share server info.""" share_server = cs.share_servers.get(args.id) # All 'backend_details' data already present as separated strings, # so remove big dict from view. if "backend_details" in share_server._info: del share_server._info["backend_details"] utils.print_dict(share_server._info)
def do_share_network_create(cs, args): """Create description for network used by the tenant""" values = {'neutron_net_id': args.neutron_net_id, 'neutron_subnet_id': args.neutron_subnet_id, 'name': args.name, 'description': args.description} share_network = cs.share_networks.create(**values) info = share_network._info.copy() utils.print_dict(info)
def do_share_network_update(cs, args): """Update share network data""" values = {'neutron_net_id': args.neutron_net_id, 'neutron_subnet_id': args.neutron_subnet_id, 'name': args.name, 'description': args.description} share_network = _find_share_network(cs, args.share_network)\ .update(**values) info = share_network._info.copy() utils.print_dict(info)
def do_security_service_create(cs, args): """Create security service used by tenant""" values = {'dns_ip': args.dns_ip, 'server': args.server, 'domain': args.domain, 'sid': args.sid, 'password': args.password, 'name': args.name, 'description': args.description} security_service = cs.security_services.create(args.type, **values) info = security_service._info.copy() utils.print_dict(info)
def do_security_service_update(cs, args): """Update security service.""" values = { 'dns_ip': args.dns_ip, 'server': args.server, 'domain': args.domain, 'user': args.user, 'password': args.password, 'name': args.name, 'description': args.description, } security_service = _find_security_service( cs, args.security_service).update(**values) utils.print_dict(security_service._info)
def do_credentials(cs, args): """Show user credentials returned from auth""" catalog = cs.client.service_catalog.catalog utils.print_dict(catalog['access']['user'], "User Credentials") utils.print_dict(catalog['access']['token'], "Token")
def do_endpoints(cs, args): """Discover endpoints that get returned from the authenticate services""" catalog = cs.client.service_catalog.catalog for e in catalog['access']['serviceCatalog']: utils.print_dict(e['endpoints'][0], e['name'])
def _print_share(cs, share): info = share._info.copy() utils.print_dict(info)
def _print_share_snapshot(cs, snapshot): info = snapshot._info.copy() info.pop('links') utils.print_dict(info)
def _quota_show(quotas): quota_dict = {} for resource in _quota_resources: quota_dict[resource] = getattr(quotas, resource, None) utils.print_dict(quota_dict)
def do_allow_access(cs, args): """Allow access to the share.""" share = _find_share(cs, args.share) access = share.allow(args.access_type, args.access_to) utils.print_dict(access)
def do_security_service_show(cs, args): """Show security service.""" security_service = _find_security_service(cs, args.security_service) info = security_service._info.copy() utils.print_dict(info)
def do_share_network_show(cs, args): """Get a description for network used by the tenant""" share_network = _find_share_network(cs, args.share_network) info = share_network._info.copy() utils.print_dict(info)
def do_share_server_details(cs, args): """Show share server details.""" details = cs.share_servers.details(args.id) utils.print_dict(details._info)
def do_metadata_show(cs, args): """Show metadata of given share.""" share = utils.find_share(cs, args.share) metadata = cs.shares.get_metadata(share)._info utils.print_dict(metadata, 'Metadata-property')
def do_metadata_update_all(cs, args): """Update all metadata of a share.""" share = utils.find_share(cs, args.share) metadata = _extract_metadata(args) metadata = share.update_all_metadata(metadata)._info['metadata'] utils.print_dict(metadata, 'Metadata-property')
def do_security_service_show(cs, args): """Show security service""" security_service = cs.security_services.get(args.security_service) info = security_service._info.copy() utils.print_dict(info)