def take_action(self, parsed_args): identity_client = self.app.client_manager.identity project = common_utils.find_project(identity_client, parsed_args.project) service = common_utils.find_service(identity_client, parsed_args.service) region = None if parsed_args.region: val = getattr(parsed_args, 'region', None) if 'None' not in val: # NOTE (vishakha): Due to bug #1799153 and for any another # related case where GET resource API does not support the # filter by name, osc_lib.utils.find_resource() method cannot # be used because that method try to fall back to list all the # resource if requested resource cannot be get via name. Which # ends up with NoUniqueMatch error. # So osc_lib.utils.find_resource() function cannot be used for # 'regions', using common_utils.get_resource() instead. region = common_utils.get_resource(identity_client.regions, parsed_args.region) limit = identity_client.limits.create( project, service, parsed_args.resource_name, parsed_args.resource_limit, description=parsed_args.description, region=region) limit._info.pop('links', None) return zip(*sorted(six.iteritems(limit._info)))
def take_action(self, parsed_args): identity_client = self.app.client_manager.identity service = None if parsed_args.service: service = common_utils.find_service(identity_client, parsed_args.service) region = None if parsed_args.region: val = getattr(parsed_args, 'region', None) if 'None' not in val: # NOTE (vishakha): Due to bug #1799153 and for any another # related case where GET resource API does not support the # filter by name, osc_lib.utils.find_resource() method cannot # be used because that method try to fall back to list all the # resource if requested resource cannot be get via name. Which # ends up with NoUniqueMatch error. # So osc_lib.utils.find_resource() function cannot be used for # 'regions', using common_utils.get_resource() instead. region = common_utils.get_resource(identity_client.regions, parsed_args.region) registered_limits = identity_client.registered_limits.list( service=service, resource_name=parsed_args.resource_name, region=region) columns = ('ID', 'Service ID', 'Resource Name', 'Default Limit', 'Description', 'Region ID') return ( columns, (utils.get_item_properties(s, columns) for s in registered_limits), )
def take_action(self, parsed_args): identity_client = self.app.client_manager.identity service = utils.find_resource( identity_client.services, parsed_args.service ) region = None if parsed_args.region: val = getattr(parsed_args, 'region', None) if 'None' not in val: # NOTE (vishakha): Due to bug #1799153 and for any another # related case where GET resource API does not support the # filter by name, osc_lib.utils.find_resource() method cannot # be used because that method try to fall back to list all the # resource if requested resource cannot be get via name. Which # ends up with NoUniqueMatch error. # So osc_lib.utils.find_resource() function cannot be used for # 'regions', using common_utils.get_resource() instead. region = common_utils.get_resource( identity_client.regions, parsed_args.region ) registered_limit = identity_client.registered_limits.create( service, parsed_args.resource_name, parsed_args.default_limit, description=parsed_args.description, region=region ) registered_limit._info.pop('links', None) return zip(*sorted(six.iteritems(registered_limit._info)))
def take_action(self, parsed_args): identity_client = self.app.client_manager.identity service = None if parsed_args.service: service = common_utils.find_service( identity_client, parsed_args.service ) region = None if parsed_args.region: region = utils.find_resource( identity_client.regions, parsed_args.region ) val = getattr(parsed_args, 'region', None) if 'None' not in val: # NOTE (vishakha): Due to bug #1799153 and for any another # related case where GET resource API does not support the # filter by name, osc_lib.utils.find_resource() method cannot # be used because that method try to fall back to list all the # resource if requested resource cannot be get via name. Which # ends up with NoUniqueMatch error. # So osc_lib.utils.find_resource() function cannot be used for # 'regions', using common_utils.get_resource() instead. region = common_utils.get_resource( identity_client.regions, parsed_args.region ) project = None if parsed_args.project: project = utils.find_resource( identity_client.projects, parsed_args.project ) limits = identity_client.limits.list( service=service, resource_name=parsed_args.resource_name, region=region, project=project ) columns = ( 'ID', 'Project ID', 'Service ID', 'Resource Name', 'Resource Limit', 'Description', 'Region ID' ) return ( columns, (utils.get_item_properties(s, columns) for s in limits), )