def validate()

in client/python/cli/command/privileges.py [0:0]


    def validate(self):
        if not self.catalog_name:
            raise Exception(f'Missing required argument: {Argument.to_flag_name(Arguments.CATALOG)}')
        if not self.catalog_role_name:
            raise Exception(f'Missing required argument: {Argument.to_flag_name(Arguments.CATALOG_ROLE)}')

        if not self.privileges_subcommand:
            raise Exception('A subcommand must be provided')
        if (self.privileges_subcommand in {Subcommands.NAMESPACE, Subcommands.TABLE, Subcommands.VIEW}
                and not self.namespace):
            raise Exception(f'Missing required argument: {Argument.to_flag_name(Arguments.NAMESPACE)}')

        if self.action == Actions.GRANT and self.cascade:
            raise Exception('Unrecognized argument for GRANT: --cascade')

        if self.privileges_subcommand == Subcommands.CATALOG:
            if self.privilege not in {i.value for i in CatalogPrivilege}:
                raise Exception(f'Invalid catalog privilege: {self.privilege}')
        if self.privileges_subcommand == Subcommands.NAMESPACE:
            if self.privilege not in {i.value for i in NamespacePrivilege}:
                raise Exception(f'Invalid namespace privilege: {self.privilege}')
        if self.privileges_subcommand == Subcommands.TABLE:
            if self.privilege not in {i.value for i in TablePrivilege}:
                raise Exception(f'Invalid table privilege: {self.privilege}')
        if self.privileges_subcommand == Subcommands.VIEW:
            if self.privilege not in {i.value for i in ViewPrivilege}:
                raise Exception(f'Invalid view privilege: {self.privilege}')