@classmethod<EOL><INDENT>def count(cls, args):<DEDENT>
inspector = SDKInspector(args.version)<EOL>name = Utils.get_singular_name(args.name)<EOL>instance = inspector.get_instance(name)<EOL>session = inspector.get_user_session(args)<EOL>parent = inspector.get_parent(args.parent_infos, session.root_object)<EOL>classname = instance.__class__.__name__[<NUM_LIT:2>:]<EOL>plural_classname = Utils.get_entity_name_plural(classname)<EOL>fetcher_name = Utils.get_python_name(plural_classname)<EOL>query_parameters = cls._get_attributes(args.query_parameters)<EOL>try:<EOL><INDENT>fetcher = getattr(parent, fetcher_name)<EOL><DEDENT>except:<EOL><INDENT>if parent.rest_name == inspector._get_package().SDKInfo.root_object_class().rest_name:<EOL><INDENT>error_message = "<STR_LIT>" % (fetcher_name)<EOL><DEDENT>else:<EOL><INDENT>error_message = "<STR_LIT>" % (parent.rest_name, fetcher_name, fetcher_name)<EOL><DEDENT>Printer.raise_error(error_message)<EOL><DEDENT>(fetcher, parent, count) = fetcher.count(filter=args.filter, query_parameters=query_parameters)<EOL>if not args.json:<EOL><INDENT>Printer.success("<STR_LIT>" % (count, instance.resource_name))<EOL><DEDENT>Printer.output({instance.resource_name: count}, fields=[instance.resource_name], json=args.json)<EOL>
Count all objects